sorting/renaming files into ./datetimeoriginal_model/

Started by TooManyPictures, March 02, 2018, 01:02:06 PM

Previous topic - Next topic

TooManyPictures

First of all ' Thank you for writing 'ExifTool' ..

Creating a directory containing the date or model on it's own (exiftool.exe "-Directory<DateTimeOriginal" -d %%Y_%%m_%%d__%%a  .) is straight forward.
For example
./2015-07-07/
or
./GT-I9300/

But combining these two values is where my problem is.

So what I want to create is:
./2015-07-07_GT-I9300/


Any help appreciated ... (I'm running this on windows cmd)

StarGeek


Try
"-Directory<${DateTimeOriginal}_${Model;}"

Since you're adding additional characters to the whole thing, you have to use the dollar sign in front of DateTimeOriginal as well as add the braces to delimit the tag name (as DateTimeOriginal_ could be created as a tag name or a variable used in advanced formatting).  Model will also need the dollar sign.  It could be used without the braces (like ${DateTimeOriginal}_$Model) but Model names often have characters that could be disruptive, such as slashes, which would end up creating a subdirectory.  When you add the braces and then the single semicolon, that will remove such characters.
* 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).

TooManyPictures

Hello,

Thank you for the help.. I think I tried that before by using:

exiftool.exe  "-Directory<${DateTimeOriginal}_${Model;}" -d %%Y_%%m_%%d__%%a  .

But it created directories like:Y_%m_ and __%a_GT-I9300

So now with your help I came to:

exiftool.exe  "-Directory<${DateTimeOriginal}_${Model;}" -d %Y_%m_%d__%a  .


and that actually worked and created:

./2015_07_07__Tue_GT-I9300

What does the semicolon after Model do?



StarGeek

Quote from: TooManyPictures on March 03, 2018, 05:46:30 AM
Thank you for the help.. I think I tried that before by using:

exiftool.exe  "-Directory<${DateTimeOriginal}_${Model;}" -d %%Y_%%m_%%d__%%a  .

You only need to double percent signs when using a windows batch file or when using a file name format replacement (%f, %d, %e) in the date format string.

QuoteWhat does the semicolon after Model do?

Quote from: StarGeek on March 02, 2018, 03:05:12 PM...but Model names often have characters that could be disruptive, such as slashes, which would end up creating a subdirectory.  When you add the braces and then the single semicolon, that will remove such characters.

For more details, see the second paragraph of docs on Advanced formatting feature.
* 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).

TooManyPictures

Hahah .. yes, thank you.. I figured that eventually out.
I did all my testing on the command line, and when I used the same expression in a .cmd it wouldn't work.

Oh dear!

One other thing I found is that when you use -Directory<${DateTimeOriginal}_${Model;}
Exiftool insists that DateTimeOriginal and Model exists in the exif-tag. If it can't find both tags it throws an error.
But that's no problem, just something I noticed

StarGeek

Quote from: TooManyPictures on March 04, 2018, 05:33:40 PMI did all my testing on the command line, and when I used the same expression in a .cmd it wouldn't work.

I'm not trying to be an ass, but...
Quote from: StarGeek on March 02, 2018, 03:05:12 PMTroubleshooting hints:
...
* Double all percent signs (%) in a Windows batch file.

QuoteOne other thing I found is that when you use -Directory<${DateTimeOriginal}_${Model;}
Exiftool insists that DateTimeOriginal and Model exists in the exif-tag. If it can't find both tags it throws an error.

See this recent thread for some tips on how to deal with it.  While the thread talks about renaming video files, the examples of renaming depending upon available tags are relevant.
* 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).