A specific timestamping scenario

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Theli
Posts: 9
Joined: 08 Sep 2016 13:54

A specific timestamping scenario

Post by Theli »

I have to change the modified date of hundreds of pictures.

These pictures have 2 (different) dates: the original date taken and the date when the file was last edited by PS CS3/CS5.
If I use File Special - Set modified date to Exif, I only get the first date. But I have a specific need for the edited date, the second one.
I searched in the help and the forum but couldn't find a way to make XY pick this date to timestamping. Is it possible?

The thought of having to change the dates one by one is haunting me... :roll:

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: A specific timestamping scenario

Post by highend »

Do you have the pro version of XY?

If yes, select one of these pictures and execute this mini script from the address bar:

Code: Select all

text "DateTime: " . get("exif", 0x0132) . "<crlf>DateTimeOriginal: " . get("exif", 0x9003) . "<crlf>DateTimeDigitized: " . get("exif", 0x9004);
Is one of these three dates the one you're looking for? Maybe the first one?
One of my scripts helped you out? Please donate via Paypal

Theli
Posts: 9
Joined: 08 Sep 2016 13:54

Re: A specific timestamping scenario

Post by Theli »

Thanks for the fast reply!

Yes, I use the pro version. And yes, the script gives me the date I need (indeed the first one).
But how to use it in a batch timestamping? Another script?

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: A specific timestamping scenario

Post by highend »

Exactly.

Select all files that need to be renamed, execute this script (e.g. from Menu - Scripting - Run Script...)

Code: Select all

    foreach($file, <get SelectedItemsPathNames |>, "|") {
        if (exists($file) != 1) { continue; }
        $exifDate = get("exif", 0x0132, $file);
        $date = gettoken($exifDate, 1);
        timestamp "m", replace($exifDate, $date, replace($date, ":", ".")), $file;
    }
Do this with a few test files first to make sure it does what you need!
One of my scripts helped you out? Please donate via Paypal

Theli
Posts: 9
Joined: 08 Sep 2016 13:54

Re: A specific timestamping scenario

Post by Theli »

I did a copy of one folder with pictures to test it.

The script seems to work but ends with an error:

Invalid date: 2010.05.24 21:50:51

Probably because the date in my system is in the format 24/05/2010.
Any way to work around this?

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: A specific timestamping scenario

Post by highend »

<- Different time format here...

Try this:

Code: Select all

    foreach($file, <get SelectedItemsPathNames |>, "|") {
        if (exists($file) != 1) { continue; }
        $exifDate = get("exif", 0x0132, $file);
        $date = gettoken($exifDate, 1);
        timestamp "m", replace($exifDate, $date, formatdate(replace($date, ":", "."))), $file;
    }
One of my scripts helped you out? Please donate via Paypal

Theli
Posts: 9
Joined: 08 Sep 2016 13:54

Re: A specific timestamping scenario

Post by Theli »

No. The error persists.

There's a way to use the script to just copy the time from the Exif tag? I can paste the date part manually if nothing else works.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: A specific timestamping scenario

Post by highend »

Not necessary

Edit: Changed it to a more elegant version...

Code: Select all

    $k = quote("HKEY_CURRENT_USER\Control Panel\International"); $v = quote("sDate");
    $delim = formatlist(gettoken(runret("REG QUERY $k /v $v"), 4, "    "), "e", <crlf>);
    foreach($file, <get SelectedItemsPathNames |>, "|") {
        if (exists($file) != 1) { continue; }
        $exifDate = get("exif", 0x0132, $file);
        $date = gettoken($exifDate, 1);
        timestamp "m", replace($exifDate, $date, formatdate(replace($date, ":", $delim))), $file;
    }
One of my scripts helped you out? Please donate via Paypal

Theli
Posts: 9
Joined: 08 Sep 2016 13:54

Re: A specific timestamping scenario

Post by Theli »

Now it worked flawlessly! :tup:

WOW. All this script thing is still a big mystery to me... :mrgreen:

Thanks so much for your time and all the help! :appl:

Post Reply