News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Windows, macOS & Linux

Started by grxgghxrpxr, January 23, 2022, 01:18:34 PM

Previous topic - Next topic

grxgghxrpxr

Hi, I am trying to create a tutorial for changing dates on photos after downloading from Google Photos. I am trying to create one that applies to Windows, macOS & Linux.

When I type the following command to add the metadata from the .json files:  'exiftool -r -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s -overwrite_original "(folder)"'. This works fine on all 3 operating systems.

But when I type the following commands:
exiftool "-datetimeoriginal>filemodifydate" -P -r "(folder)"'
exiftool -v "-png:creationtime<filemodifydate" -overwrite_original "(folder)"
'exiftool "-createdate>filemodifydate" -P -r "(folder)"'
They work fine on Windows, but on macOS & Linux, it just comes up with '<' & doesn't do anything.

Is there something I'm doing wrong?

Thanks
Gregg

StarGeek

Quote from: grxgghxrpxr on January 23, 2022, 01:18:34 PM
This works fine on all 3 operating systems.

Correction, this will not work on Windows CMD, only Windows PowerShell.  Single quotes are used for Mac/Linux/PowerShell but double quotes are needed in CMD.

QuoteBut when I type the following commands:
exiftool "-datetimeoriginal>filemodifydate" -P -r "(folder)"'

Be careful with your quotes.  In htis example you are using " and ', fancy/curly quotes.  These will not work on any platform.  There's a setting on Macs which will automatically "help" you by converting regular quotes into these.  Also, most word processors, including Google Docs, will also convert them, so it's not advised to copy/paste commands into them.

QuoteThey work fine on Windows, but on macOS & Linux, it just comes up with '<' & doesn't do anything.

As long as you're not using the fancy quotes, then double quotes should work correctly on Mac/Linux except when there's a dollar sign involved.  Using double quotes around a dollar sign will tell the shell to treat this as the start of a shell variable.  There may be other characters as well.  I know there's some rules for using an asterisk on those systems, but can never remember what they are.  See also Common Mistake #2.

I'm not sure about double quotes on PowerShell, but there are other problems using exiftool with PS.  The major one is if you try to extract binary data, such as an embedded thumbnail, as PS will corrupt such data.  See here.

Basically, you can't always make a single command to run one all systems, because each system has it's own peculiarities.

One final point which I always have to make with regards to Google Photos.  Google does not remove any metadata from the files.  The metadata in the downloaded files is the same as when it was uploaded.  The only time you actually need to process the json files is if you edited data on the Google website.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

grxgghxrpxr

Quote from: StarGeek on January 23, 2022, 01:36:14 PM
Quote from: grxgghxrpxr on January 23, 2022, 01:18:34 PM
This works fine on all 3 operating systems.

Correction, this will not work on Windows CMD, only Windows PowerShell.  Single quotes are used for Mac/Linux/PowerShell but double quotes are needed in CMD.

QuoteBut when I type the following commands:
exiftool "-datetimeoriginal>filemodifydate" -P -r "(folder)"'

Be careful with your quotes.  In htis example you are using " and ', fancy/curly quotes.  These will not work on any platform.  There's a setting on Macs which will automatically "help" you by converting regular quotes into these.  Also, most word processors, including Google Docs, will also convert them, so it's not advised to copy/paste commands into them.

QuoteThey work fine on Windows, but on macOS & Linux, it just comes up with '<' & doesn't do anything.

As long as you're not using the fancy quotes, then double quotes should work correctly on Mac/Linux except when there's a dollar sign involved.  Using double quotes around a dollar sign will tell the shell to treat this as the start of a shell variable.  There may be other characters as well.  I know there's some rules for using an asterisk on those systems, but can never remember what they are.  See also Common Mistake #2.

I'm not sure about double quotes on PowerShell, but there are other problems using exiftool with PS.  The major one is if you try to extract binary data, such as an embedded thumbnail, as PS will corrupt such data.  See here.

Basically, you can't always make a single command to run one all systems, because each system has it's own peculiarities.

One final point which I always have to make with regards to Google Photos.  Google does not remove any metadata from the files.  The metadata in the downloaded files is the same as when it was uploaded.  The only time you actually need to process the json files is if you edited data on the Google website.

Thank you for this! I've worked it out now.

Another issue I'm having is on macOS, when I type in the commands, it says the photos' Date Modified are changed, but when I go on Get Info on Finder, the Date Modified are still the same.

Plus, when I type the .png command (as previously mentioned), the Date Modified doesn't change on macOS or Linux, but some do change on Windows. Why is this?

Thank you
Gregg

StarGeek

Quote from: grxgghxrpxr on January 23, 2022, 06:20:25 PMAnother issue I'm having is on macOS, when I type in the commands, it says the photos' Date Modified are changed, but when I go on Get Info on Finder, the Date Modified are still the same.

Most likely FAQ #3.  Finder is showing you one time stamp and not the other.  Most likely one is FileModifyDate, the file system time stamp, and the other is the embedded ModifyDate, which is probably EXIF but could be XMP as well.

QuotePlus, when I type the .png command (as previously mentioned), the Date Modified doesn't change on macOS or Linux, but some do change on Windows. Why is this?

You'll have to check the data using the command from the above FAQ.  Normally, any time a file is edited, the file system time stamp, FileModifyDate, will be changed (see the -P (-preserve) option to keep it unchanged).  Additionally, on the Mac, some of what Finder is showing you might be Mac specific file system tags (see MacOS tags).  These might change or be lost under normal exiftool operation because exiftool creates a new file when editing and adds _original to original file.  Since it's a new file, it won't have the same extended file system data that the original had.  The -overwrite_original_in_place option option will keep the tags, but you no longer have a backup _original file when using that option.

Finally, PNGs have very little metadata support overall.  For example, Windows will only read one embedded tag in a PNG file and nothing else.

For Windows, this post shows what tags Windows reads when you look at a file with Properties -> Details tab.  The time stamps on the first tab (General) are the file system time stamps.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

grxgghxrpxr

Quote from: StarGeek on January 23, 2022, 08:40:52 PM
Quote from: grxgghxrpxr on January 23, 2022, 06:20:25 PMAnother issue I'm having is on macOS, when I type in the commands, it says the photos' Date Modified are changed, but when I go on Get Info on Finder, the Date Modified are still the same.

Most likely FAQ #3.  Finder is showing you one time stamp and not the other.  Most likely one is FileModifyDate, the file system time stamp, and the other is the embedded ModifyDate, which is probably EXIF but could be XMP as well.

QuotePlus, when I type the .png command (as previously mentioned), the Date Modified doesn't change on macOS or Linux, but some do change on Windows. Why is this?

You'll have to check the data using the command from the above FAQ.  Normally, any time a file is edited, the file system time stamp, FileModifyDate, will be changed (see the -P (-preserve) option to keep it unchanged).  Additionally, on the Mac, some of what Finder is showing you might be Mac specific file system tags (see MacOS tags).  These might change or be lost under normal exiftool operation because exiftool creates a new file when editing and adds _original to original file.  Since it's a new file, it won't have the same extended file system data that the original had.  The -overwrite_original_in_place option option will keep the tags, but you no longer have a backup _original file when using that option.

Finally, PNGs have very little metadata support overall.  For example, Windows will only read one embedded tag in a PNG file and nothing else.

For Windows, this post shows what tags Windows reads when you look at a file with Properties -> Details tab.  The time stamps on the first tab (General) are the file system time stamps.

Thank you so much for this, I really appreciate it. I stupidly pointed the arrow to FileModifyDate, that's why they weren't changing. But now all my problems are solved. Thank you so much!