Figuring out the command line

Started by Povitch, January 08, 2023, 05:56:20 PM

Previous topic - Next topic

Povitch

Hi All,

I am green as with this tool. I have about 50,000 images and movies on a mac that I want to organise into folders in the format yyyy/mm/dd based on datetimeoriginal, createDate, Lastmodified. I can do that. When I tested, there were a few errors based on the file already existing.

1) I don't know if the file that was a duplicate was just deleted or what happened to it given the syntax below
2) I would like to move, and at the same time, if the file exists, rename with a -1 or a -2 etc. I can see something like this is possible, but I can't work out how to add it to this following command to make it do what I want.

Please could somebody explain it to me so I can work it out? Thanks in advance!

exiftool -r -d %Y/%m/%d "-directory<filemodifydate" "-directory<createdate" "-directory<datetimeoriginal" .


Phil Harvey

If there is a duplicate file, only one would be moved by your command.

To move duplicate files and add -1, etc to their names, you could do this:

exiftool -r -d %Y/%m/%d/%%f%%-c.%%e "-filename<filemodifydate" "-filename<createdate" "-filename<datetimeoriginal" .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Povitch

Thank you very much. I am working out through this how the syntax works. Could you also show me how to add something to that so that if I want the new directories to be in a different location to the original. Much appreciated.

Phil Harvey

exiftool -r -d "/some/other/directory/specification/%Y/%m/%d/%%f%%-c.%%e" "-filename<filemodifydate" "-filename<createdate" "-filename<datetimeoriginal" .

If the directory starts with "/" it is an absolute directory name, ie. "/Users/Phil/Pictures/My Trip".  If the name contains spaces then the argument on the command line must be quoted as I have done above.

If the directory doesn't start with "/" then it is a relative directory based on the current working directory (use the "pwd" command to see the current working directory name).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Povitch

#4
I think you might be saving my photo life! Thank you so much! This tool is really appreciated and pending final tests, I might have a solution to something I have been struggling with for ages. If you don't mind, please could you help me just understand these minor error messages so I can complete my testing hopefully....

Warning: [minor] The ExtractEmbedded option may find more tags in the media data - ./1970/01/01/IMG_4161.MOV

Warning: [minor] Possibly incorrect maker notes offsets (fix by -222?) - ./1970/01/01/IMG_0027.JPG

Warning: Invalid EXIF text encoding for UserComment - ./2002/12/28/IMG_0096.jpg (I think this one is because I used jpegshrink on the photo and it put this in the comments - Comment : Optimized by JPEGmini 3.14.12.71901706 0x2dca05e8)

This one also got me stumped - I tried to search the FAQ with no luck...Warning: End of processing at large atom (LargeFileSupport not enabled) - ./1970/01/01/IMG_3742(1).MOV

Again...thanks. Having this tool is great, but having your support as I work it out is even more helpful.

Phil Harvey

There are literally hundreds of possible warnings, and I can't explain them all, but I will start you off by helping with these ones.

Quote from: Povitch on January 09, 2023, 04:36:13 PMWarning: [minor] The ExtractEmbedded option may find more tags in the media data - ./1970/01/01/IMG_4161.MOV

There were possibly more tags in the file that weren't extracted because parsing the media data is slow.  You don't need to worry about this because the CreateDate is all you really need here.

QuoteWarning: [minor] Possibly incorrect maker notes offsets (fix by -222?) - ./1970/01/01/IMG_0027.JPG

Some other software modified the file and didn't update the maker notes properly.  See FAQ 15 for an explanation.

QuoteWarning: Invalid EXIF text encoding for UserComment - ./2002/12/28/IMG_0096.jpg (I think this one is because I used jpegshrink on the photo and it put this in the comments - Comment : Optimized by JPEGmini 3.14.12.71901706 0x2dca05e8)

Likely yes.  Whatever wrote UserComment didn't do it properly.

QuoteThis one also got me stumped - I tried to search the FAQ with no luck...Warning: End of processing at large atom (LargeFileSupport not enabled) - ./1970/01/01/IMG_3742(1).MOV

When reading video files, ExifTool will stop if it encounters a data block > 2 GB in size.  You can probably ignore this since CreateDate should be in the file header.  But you can add the -api largefilesupport option to enable reading past these large blocks.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Povitch

Again. Many thanks for your time. I am trying all of this out and its looking great.