ExifTool Forum

ExifTool => Newbies => Topic started by: werwolf on November 24, 2017, 09:47:38 AM

Title: how to rename Files with a fixed pretext "IMG_" ?
Post by: werwolf on November 24, 2017, 09:47:38 AM
hello,
I cannot find any information in the documentation to solve my problem.
I use synology Apps to save the pictures on my synology  NAS.
The app renames the files like this "IMG_YYYMMDD_hhmmss"


So far I used
exiftool "-filename<CreateDate" -d %Y%m%d_%H%M%S_%%f%%c.%%le -r -progress -ext jpg
to rename my files, but then I have some pictures starting with IMG_ and some with 2017 ...
currently I need to rename them using Windows commandline..

So my question is:
how do I add the fixed string "IMG_" when I want to rename the files?

Any Idea how
Title: Re: how to rename Files with a fixed pretext "IMG_" ?
Post by: Phil Harvey on November 24, 2017, 11:07:34 AM
I'm confused.  You have %%f in your date/time format string, which will embed the original file name.  What is the exact form of the file names that you want?  If it is "IMG_YYYMMDD_hhmmss.ext", then try this:

exiftool "-filename<CreateDate" -d IMG_%Y%m%d_%H%M%S%%-c.%%le -r -progress -ext jpg DIR

- Phil
Title: Re: how to rename Files with a fixed pretext "IMG_" ?
Post by: werwolf on November 26, 2017, 05:01:30 PM
Yes, your answer was the one I was looking for.
it works great.

Did I miss it in the documentation, or where is this mentioned
Title: Re: how to rename Files with a fixed pretext "IMG_" ?
Post by: StarGeek on November 27, 2017, 12:23:17 AM
Quote from: werwolf on November 26, 2017, 05:01:30 PM
Did I miss it in the documentation, or where is this mentioned

It's not explicitly stated, AFAIK.  It's easy to assume that it has to be some sort of date format a person would know.  But Example #6 (https://exiftool.org/filename.html#ex6) on the Writing "FileName" and "Directory" tags page is an example of it.
Title: Re: how to rename Files with a fixed pretext "IMG_" ?
Post by: Phil Harvey on November 27, 2017, 07:18:37 AM
Quote from: StarGeek on November 27, 2017, 12:23:17 AM
It's not explicitly stated, AFAIK.

Does it help if I change the -d documention to this?:

       -d FMT (-dateFormat)
            Set the format for date/time tag values.  The FMT string may
            contain formatting codes beginning with a percent character ("%")
            to represent the various components of a date/time value.  The
            specifics of the FMT syntax are system dependent -- consult the
            "strftime" man page on your system for details.  The default
            format is equivalent to "%Y:%m:%d %H:%M:%S".   [...]

- Phil
Title: Re: how to rename Files with a fixed pretext "IMG_" ?
Post by: werwolf on August 04, 2018, 03:56:29 PM
cannot say really.
For me what works best is, the short explanation and 1-2 examples how this is applied.
This also helps the persons who are not experts to understand it.