Hello,
I'm trying to copy files to a folder structure based on DateTimeOriginal (/%Y/%m/%d) while preserving the original filename, however, I know i have some duplicate filenames in some subfolders of the original folder. I can't seem to get the command line working to have the duplicate file appear in the folder with the append a copy number.
exiftool -o %f%-c.%e "-directory<FileModifyDate" "-directory<CreateDate" "-directory<DateTimeOriginal" -d e:/temp/%Y/%m/%d -r .
Error: 'e:/temp/2001/07/07/DCP01595-1.JPG' already exists - ./DCP01595.JPG
Error: 'e:/temp/2001/07/07/DCP01596-1.JPG' already exists - ./DCP01596.JPG
Error: 'e:/temp/2001/07/07/DCP01597-1.JPG' already exists - ./DCP01597.JPG
Error: 'e:/temp/2001/07/07/DCP01603-1.JPG' already exists - ./DCP01603.JPG
16 directories scanned
64 directories created
0 image files updated
834 image files copied
82 files weren't updated due to errors
I just get one copy of the file, with the -1 appended.??
Move your -o arguments into the date format string (doubling the percent signs), use Filename instead of Directory, and provide a dummy argument for the -o (outfile) option (https://sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#o-OUTFILE-or-FMT--out) (see the first paragraph there).
So try something like this. Test it first because I have not tested it.
exiftool -o . "-Filename<FileModifyDate" "-Filename<CreateDate" "-Filename<DateTimeOriginal" -d e:/temp/%Y/%m/%d/%%f%%-c.%%e -r .
thanks for you comments...
I have tried that exact form of command line and end up with a single image file in a folder with the same name... so something is not quite right...?
Here's the output I get with the starting and ending directory structure.
C:\>tree /f Y:\!temp\mmm
Folder PATH listing for volume DrivePool
Volume serial number is 00000029 3881:4F27
Y:\!TEMP\MMM
│ mmm.rar
│
├───Source
│ │ Test-NoDate.jpg
│ │
│ ├───01
│ │ Test-DateTimeOriginal.jpg
│ │
│ └───02
│ Test-CreateDate.jpg
│ Test-DateTimeOriginal.jpg
│
└───Target
C:\>exiftool -o . "-Filename<FileModifyDate" "-Filename<CreateDate" "-Filename<DateTimeOriginal" -d "Y:\!temp\mmm\Target/%Y/%m/%d/%%f%%-c.%%e" -r Y:\!temp\mmm\Source
3 directories scanned
3 directories created
4 image files copied
C:\>tree /f Y:\!temp\mmm
Folder PATH listing for volume DrivePool
Volume serial number is 00000029 3881:4F27
Y:\!TEMP\MMM
│ mmm.rar
│
├───Source
│ │ Test-NoDate.jpg
│ │
│ ├───01
│ │ Test-DateTimeOriginal.jpg
│ │
│ └───02
│ Test-CreateDate.jpg
│ Test-DateTimeOriginal.jpg
│
└───Target
├───2010
│ └───12
│ └───12
│ Test-DateTimeOriginal-1.jpg
│ Test-DateTimeOriginal.jpg
│
└───2020
└───01
├───01
│ Test-CreateDate.jpg
│
└───29
Test-NoDate.jpg
The only way I found to get single images in a folder with the same name was to keep Directory instead of changing to Filename.
dang, I see what I did wrong... thanks for sorting it out for me... i didnt realize that there was different effects from using -directory vs -filename
i thought you needed to use directory to generate the folders, i see now that filename will support folder creation too...
just starting to get the hang of difference in descriptions now...
thanks again!
Quote from: jgsprenger on January 29, 2020, 12:12:03 PMi see now that filename will support folder creation too...
Yep, see third paragraph under Writing "FileName" and "Directory" tags (https://exiftool.org/filename.html).