I'm using the following script to rename hundreds of image files...
exiftool -P -d "%Y-%m%d-%H%M.%S" -c "%.3f" '-FileName<(noGPS)_%f.%e' '-FileName<(noGPS)_${Model}_%f%-c.%e' '-FileName<(${GPSLatitude} ${GPSLongitude})_${Model}_%f%-c.%e' '-FileName<${ModifyDate}_(noGPS)_%f%-c.%e' '-FileName<${ModifyDate}_(noGPS)_${Model}_%f%-c.%e' '-FileName<${ModifyDate}_(${GPSLatitude} ${GPSLongitude})_${Model}_%f%-c.%e' '-FileName<${CreateDate}_(noGPS)_%f%-c.%e' '-FileName<${CreateDate}_(noGPS)_${Model}_%f%-c.%e' '-FileName<${CreateDate}_(${GPSLatitude} ${GPSLongitude})_${Model}_%f%-c.%e' '-FileName<${DateTimeOriginal}_(noGPS)_%f%-c.%e' '-FileName<${DateTimeOriginal}_(noGPS)_${Model}_%f%-c.%e' '-FileName<${DateTimeOriginal}(${GPSLatitude} ${GPSLongitude})_${Model}_%f%-c.%e' "$f"
It works fine with image files that have a "real" date (Date/Time Original, Create Date or Modify Date). The problem is when there is no date in either of those three tags.
I'd like dateless images to look like this...
(noGPS)_IMG_0123 or
(noGPS)_CannonXXX_IMG_0123, etc.
If the first naming segment of the script looks like '-FileName<(noGPS)_%f.%e'
the file does not get renamed.
If the first naming segment of the script above looks like '-FileName<$(noGPS)_%f.%e'
the file gets renamed to $(noGPS)_IMG_0123.
I can't figure out how to just get "(noGPS)_" to be inserted at the beginning.
Can anyone tell me what I am doing incorrect?
Thanks,
-k-
Try an equal sign = instead of the less than < sign.
For this first case you are setting the filename to a static value rather than to a tag value.
StarGeek is correct.
The reason for this is that without a "$" in the source parameter, it is interpreted as a tag name (as in "-DSTDAG<SRCTAG"). Maybe I should add a warning, because in cases like this ExifTool could warn that the tag name is invalid.
- Phil
Thanks for the response guys! It worked great for the first instance!
My next question is, will the second instance (no date, no gps but a camera model) work like this...?
'-FileName=(noGPS)_${Model}_%f%-c.%e'
I am assuming that when the new file name does not begin with a tag, it should be "-FileName=" rather than "-FileName<". Is this a correct assumption?
Thanks again.
-k-
I think I figured out some of it myself.
It appears that if there is a tag anywhere in the new file name, you must use "-FileName<"
-k-
Here is a break-down of the command I am using...
exiftool -P -d "%Y-%m%d-%H%M.%S" -c "%.3f"
'-FileName=(noGPS)_%f.%e'
'-FileName<(noGPS)_${Model;}_%f%-c.%e'
'-FileName<(${GPSLatitude} ${GPSLongitude})_${Model;}_%f%-c.%e'
'-FileName<${ModifyDate}_(noGPS)_%f%-c.%e'
'-FileName<${ModifyDate}_(noGPS)_${Model;}_%f%-c.%e'
'-FileName<${ModifyDate}_(${GPSLatitude} ${GPSLongitude})_${Model;}_%f%-c.%e'
'-FileName<${CreateDate}_(noGPS)_%f%-c.%e'
'-FileName<${CreateDate}_(noGPS)_${Model;}_%f%-c.%e'
'-FileName<${CreateDate}_(${GPSLatitude} ${GPSLongitude})_${Model;}_%f%-c.%e'
'-FileName<${DateTimeOriginal}_(noGPS)_%f%-c.%e'
'-FileName<${DateTimeOriginal}_(noGPS)_${Model;}_%f%-c.%e'
'-FileName<${DateTimeOriginal}(${GPSLatitude} ${GPSLongitude})_${Model;}_%f%-c.%e' "$f"
Does anyone see any further problems in this script?
-k-
Looks good. Good thinking with the semicolon to filter the Model string (otherwise you would be creating new directories if the model name contained a "/").
If you want to test this before renaming all your files, change FileName to TestName and run the script like that first.
- Phil
Thanks for personally responding, Phil.
I did numerous tests and all appears to be working perfectly and have since re-named a couple thousand files.
The further I dig, the more amazing I find this app to be. And seeing all your assistance on the forums is even more impressive.
Thanks again,
-k-