how to rename Files with a fixed pretext "IMG_" ?

Started by werwolf, November 24, 2017, 09:47:38 AM

Previous topic - Next topic

werwolf

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

werwolf

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

StarGeek

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 on the Writing "FileName" and "Directory" tags page is an example of it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

werwolf

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.