ExifTool Forum

ExifTool => Newbies => Topic started by: irinaonline on June 15, 2017, 05:34:04 PM

Title: Renaming Files based on DateTimeOriginal and a custom text
Post by: irinaonline on June 15, 2017, 05:34:04 PM
"-FileName<EXIF:DateTimeOriginal TEST" does not seem to work. What is the syntax to just add a custom text to the filename?
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: Phil Harvey on June 15, 2017, 05:51:33 PM
"-FileName<$EXIF:DateTimeOriginal TEST"
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: irinaonline on June 15, 2017, 06:00:05 PM
thanks. worked. but with "-FileName<$EXIF:DateTimeOriginal 0WL1" "%%Y%%m%%d %%H%%M%%S%%%%-c.%%%%ue" he swallowed my extension now
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: StarGeek on June 15, 2017, 06:10:54 PM
Move the Count and Extension variables out of the date format and into the rename part.  The percent signs only need to be doubled once in there:
exiftool  "-FileName<$EXIF:DateTimeOriginal 0WL1%%-c.%%ue" -d "%%Y%%m%%d %%H%%M%%S"

Example (not from bat file, so % not doubled)
C:\>exiftool "-testname<$EXIF:DateTimeOriginal 0WL1%-c.%ue" -d "%Y%m%d %H%M%S" X:\!temp\Test3.jpg
'X:/!temp/Test3.jpg' --> 'X:/!temp/20151212 121212 0WL1.JPG'
    0 image files updated
    1 image files unchanged
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: irinaonline on June 15, 2017, 09:25:02 PM
perfect, thank you!
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: alexy frangieh on July 17, 2017, 02:11:48 PM
great evening doctor,
please, i have a tree structure containing about 150.000 photos in a sequence (same camera)
i need to rename the whole in the following format ProjectXXXXXX where XXXXXX is the unique value of the -shuttercount exif extract

please can you provide me with a full syntax, including any eventual -r or a file overwrite

much appreciated sir
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: Hayo Baan on July 18, 2017, 05:33:19 AM
The following command would rename all files in DIR (and below) that have a shutter count to Projectxxxx.

exiftool -if '$ShutterCount' '-FileName<Project$ShutterCount.%e' -r DIR
But that would result in file names with different lengths. If you'd like all the shutter counts to have the same number of digits (e.g. 6), use this:
exiftool -if '$ShutterCount' '-FileName<${ShutterCount; $_ = substr("000000$_",-6);}.%e' -r DIR

Note: test this out on a small number of files first, of course...
Title: Re: Renaming Files based on DateTimeOriginal and a custom text
Post by: alexy frangieh on July 18, 2017, 06:15:15 AM
worked like charm! thank you