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.
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 (https://exiftool.org/exiftool_pod.html#o-OUTFILE-or-FMT--out)
requires a second parameter. Because you have not provided one, the
-d (
-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) 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 (https://exiftool.org/filename.html).
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