Hello,
With a new Windows 7 64 bit computer, software incompatibilities require me to come up with a new workflow for importing my photos. I had already been using ExifTool to modify some metadata so it seemed logical to add an ExifTool command to my batch file to implement my system of renaming the files and assigning them to folders by capture date. The results of my attempt were unexpected and quite a mess.
For testing at a command prompt, I simplified to just trying to rename a file by typing:
exiftool "-filename<datetimeoriginal" -d %y%m%d_%-4f.%%e "M:\My Pictures\Pentax K10D Images\temp for ExifTool\_IGP4667.dng"
This returned a message: Error creating directory %y%mM:
To simplify further, I placed a copy of the file in my working directory and with the command:
exiftool -d %y%m%d_%-4f.%e "-filename<datetimeoriginal" _IGP4667.DNG
I was able to rename the file to %y%m_4667.dng. I cannot come up with any variation that will format the date in the filename ... the date/time parser does not seem to be available. Running the command prompt "as administrator" makes no difference.
On my old Windows XP computer (with the same directory structure), I can enter:
exiftool "-filename<datetimeoriginal" -d %y%m%d_%%-4f.%%e "M:\My Pictures\Pentax K10D Images\temp for ExifTool\_IGP4667.dng"
to successfully rename the file to 110319_4667.dng as I intended. But I need to do this on my new computer (in a batch file). Can you help?
Quote from: RGBdreams on March 26, 2011, 11:59:40 PM
For testing at a command prompt, I simplified to just trying to rename a file by typing:
exiftool "-filename<datetimeoriginal" -d %y%m%d_%-4f.%%e "M:\My Pictures\Pentax K10D Images\temp for ExifTool\_IGP4667.dng"
You need two "%" characters in "%%-4f".
Quote
This returned a message: Error creating directory %y%mM:
This I do not understand. Is it possible that the spaces in your command may not really be spaces, but some other character that just looks like a space? Did you cut and paste these or type them from the keyboard? Sometimes cut-n-paste from other sources can yield funny characters.
QuoteTo simplify further, I placed a copy of the file in my working directory and with the command:
exiftool -d %y%m%d_%-4f.%e "-filename<datetimeoriginal" _IGP4667.DNG
You forgot to double the "%" characters for both "%%-4f" and "%%e" here.
Quote
I was able to rename the file to %y%m_4667.dng.
Odd. I would suggest taking a step back and making sure that the date formatting is working correctly. Try this:
exiftool -datetimeoriginal -d %y%m%d FILEAlso, try quoting the "%y%m%d" for fun if it doesn't work.
QuoteOn my old Windows XP computer (with the same directory structure), I can enter:
exiftool "-filename<datetimeoriginal" -d %y%m%d_%%-4f.%%e "M:\My Pictures\Pentax K10D Images\temp for ExifTool\_IGP4667.dng"
This command should work in any Windows system, so there must be something funny causing this difference.
- Phil
Thank you, Phil.
Quote from: authorFor testing at a command prompt, I simplified to just trying to rename a file by typing:
exiftool "-filename<datetimeoriginal" -d %y%m%d_%-4f.%%e "M:\My Pictures\Pentax K10D Images\temp for ExifTool\_IGP4667.dng"
QuoteYou need two "%" characters in "%%-4f".
Ooops! That missing "%" character was the cause of all my strange output. It seems I missed the double escape on that one in my batch file and carried the error through translating it back to the command line. I should have tested in the command line first. Sorry to have troubled you over something like that. Anyway, my batch file is doing everything I want now so I am happy.
I appreciate your quick reply. Your support is much better than that of most commercial software vendors! It looks like I will be using ExifTool pretty regularly now and a donation is in order for the value you provide.
John