Trouble copying files to new Date based directory structure

Started by _ginger_kid, October 24, 2022, 08:24:50 AM

Previous topic - Next topic

_ginger_kid

I'm trying to organise a lot of old photos using the following command to copy the source in a directory structure that is YEAR/YEAR-MONTH based. I have tried a variety of combinations of property order, but it does not work.

The command

exiftool '-Directory<CreateDate'-o -d /media/organisedphotos/%Y/%Y-%m '-Directory<CreateDate' -r /media/photos

Instead of the desired directory structure exiftool creates a directory with the original CreateDate format in the current directory, copies the first file and renames it to -d, and then errors the remaining files as it is trying to copy them all to the same name. It outputs this log

Warning: Error opening file - /media/organisedphotos/%Y/%Y-%m
Error: Error opening file - /media/organisedphotos/%Y/%Y-%m
Error: '2004:06:05 22:32:46/-d' already exists - /media/photos/woywoy/10.jpg

I have tried re-ordering arguments etc but to no avail. Any tips greatly received. I am sure I have missed something obvious but I cannot tell what.




StarGeek

Are you trying to move the files to the new location or are you trying to make copies of the files in the new location?


Quote from: _ginger_kid on October 24, 2022, 08:24:50 AMThe command
exiftool '-Directory<CreateDate'-o -d /media/organisedphotos/%Y/%Y-%m '-Directory<CreateDate' -r /media/photos

A space is required between CreateDate' -o, but I assume that the command you run includes this by the output you list.  The problem is that the -o (-out) option requires a second parameter.  Because you have not provided one, the -d (-dateFormat) option is used as the second parameter, which is why your directory is -d and your date format is ignored and the date string is treated as a filename to process, which gives the Error opening file results.

See also Writing "FileName" and "Directory" tags.
* 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).

_ginger_kid

I am trying to copy them. Thanks for the tips, I have got it working now. For future users the correct command is below. The key is that -d overrides -o, but you need -o to copy, not move. The dir provided to the -o param is ignored, and -d should be fully qualified if you're not running the command in the destination root directory.

exiftool -r -o . -d /media/organisedphotos/%Y/%Y-%m-%d '-Directory<CreateDate' /media/photos