Can someone point me in the right direction about how to preserve the original filename of an image when using exiftool to rename a file based in the date and time in the exif data
essentially something like this
2014-12-27 at 19-17-22_"originalfilename".jpg
cheers
You want the new file name to contain the old name? The command would look something like this:
exiftool "-filename<${datetimeoriginal}_$filename" -d "%Y-%m-%d at %H-%M-%S" DIR
where DIR is the name of a directory containing the images. (The above quoting is for Windows. Use single quotes instead if you are on Max/Linux)
Be sure to test this command first to make sure it does what you want because it is difficult to go back after renaming a file.
- Phil
Thankyou!
_$filename was the snippet I was missing
Cheers
Can you help me?
I want to create a directory depending on the date, but want to preserve the filename.
I found THIS code for creating the directory, that works fine.
/usr/bin/exiftool "-filename<CreateDate" -d "/volume1/photo/%Y-%m/%Y-%m-%d %H-%M-%S%%-c.%%le" -r /volume1/import
But when i change it to /usr/bin/exiftool "-filename<CreateDate" -d "/volume1/photo/%Y-%m-%d/%filename" -r /volume1/import
it won´t work.
And it looks like that " is working better with linux than '. Was it changed?
Greetings Christian. Please try %%f for producing original filenames, so maybe it can be something like ...
exiftool -TESTname'<CreateDate' -d '/volume1/photo/%Y-%m/%Y-%m-%d %H-%M-%S/%%f%%-c.%%le' -r /volume1/import
Since you're just moving the file rather than renaming it, use Directory instead of Filename (see Writing "FileName" and "Directory" tags (https://exiftool.org/filename.html), also see the -d (dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) for details on times you have to double the percent sign).
exiftool '-Directory<CreateDate' -d '/volume1/photo/%Y-%m-%d' -r /volume1/import
I also changed the double quotes to single quotes. Either can be used for this command, but there are commands when run on linux/Mac that would require single quotes and it's a good habit to get into.
Greetings StarGeek. Many thanks for the extra information, its good advice.
Im wish to mention writing $Directory, but cant invent ways to include %c for duplicate names? Is this to be possible????
The problem is I never write $Directory, because $TESTname makes easier experiments (I wish for $TESTDirectory to experiment without -p command).
Quote from: Luuk2005 on December 29, 2020, 10:04:16 PM
Im wish to mention writing $Directory, but cant invent ways to include %c for duplicate names? Is this to be possible????
The
%c won't really work when moving a file using the
Directory pseudo tag. But @Christian72D only wanted to move and wasn't using
%c, which is why I suggested using
Directory instead.