Page 1 of 1

Clone created & modifed dates from one file to another

Posted: 07 May 2026 23:44
by Schuller
I'm looking for an easier way to clone the created & modified dates & times from one file to another file and hoping it can be achieved through scripting.

So far I've been using the Info panel Properties tab but the frequency at which I do this I think I'd be better off scripting.

Also, I tried some other scripts from Google AI overview but that was not successful.

My logic with my XY knowledge to date tells me it should work something like this:

1. Select source file
2. Press scripted user button which copies the created & modified dates & times to the clipboard.
3. Go to target location and select target file(s)
4. Press scripted user button which pastes the created & modified dates & times to selected target file(s)

Can someone please help to me to achieve this and also, if my logic is not logic-ing with your understanding and you know a better way to accomplish this then please advise.

Thanks

Re: Clone created & modifed dates from one file to another

Posted: 08 May 2026 07:01
by highend
If really using a single pane:

Code: Select all

    // Transfer created & modified date from one item to another
    perm $P_Dates;

    $copied = (regexmatches($P_Dates, "^dt")) ? true : false;

    // Copy from src
    if (!$copied) {
        end (get("countselected") != 1), "No or more than one item(s) selected, aborted!";
        $dateC   = property("#date.c");
        $dateM   = property("#date.m");
        $P_Dates = "dt|$dateC|$dateM";

    // Apply to dst
    } else {
        end (get("countselected") == 0), "No item(s) selected, aborted!";
        $dateC = gettoken($P_Dates, 2, "|");
        $dateM = gettoken($P_Dates, 3, "|");
        timestamp "c", $dateC;
        timestamp "m", $dateM;
        $P_Dates = "";
    }
It doesn't require the clipboard to be modified...

Re: Clone created & modifed dates from one file to another

Posted: 08 May 2026 07:33
by Schuller
Works perfect!
Thanks

Re: Clone created & modifed dates from one file to another

Posted: 08 May 2026 13:18
by highend
Thanks (as always :)) for the donation :tup: