Hi,
After a slow start I finally managed to construct my own set of commands to rename my movies and pictures. Thanks a lot for this great tool!
Now I came across a tricky problem I could use some help with, if possible.
I have folders with movies named like "description_of_movie 01.12.2010 640x480", date and resolution have been added with picasa when renaming the files for the first time. Now I would like to change that to something like "$createdate_$imagesize_description_of_movie".
That means, I would like to crop the original filename before the first blank that was created with picasa. I do not have blanks in the description string! After that I would be able to use something like
exiftool -ext 3gp -ext avi '-filename<${createdate}_${imagesize}_%f.%e' -d "%Y-%m-%d_%H_%M_%S" ./
Is cropping possible? If you see any other workaround to avoid manually cropping the filenames I would be happy, too, of course!
Many thanks
Don
Hi Don,
Try this:
exiftool '-filename<${createdate}_${imagesize}_${filename;s/ .*//}.%e' -d "%Y-%m-%d_%H_%M_%S" DIR
where DIR is the name of the directory with the images. Here I have used single quotes because you did, which are for Mac/Linux. Windows people would use double quotes.
- Phil
Wow, that was quick, and it worked! Thanks!
If I may bother you again, how does that command work? I found some examples for these advanced substring modifications on your application page, I cannot give you the direct link, so I pasted it below so that you know which part of the documentation I refer to.
However, I am still very confused by the syntax of these substring modifications. Is there a walkthrough somewhere step by step for newbies, or could you explain just how your command works so that I might be able to construct my own set of commands?
Again, I am very very grateful for your tool and your help. All other GUI image tools I tried came not even close to this flexibility.
Best regards
Don
--- pasted from http://www.exiftool.org/exiftool_pod.html
A substring of the original file name, directory or extension may be taken by specifying a field width immediately following the '%' character. If the width is negative, the substring is taken from the end. The substring position (characters to ignore at the start or end of the string) may be given by a second optional value after a decimal point. For example:
Input File Name Format Specifier Output File Name
---------------- ---------------- ----------------
Picture-123.jpg %7f.txt Picture.txt
Picture-123.jpg %-.4f.out Picture.out
Picture-123.jpg %7f.%-3f Picture.123
Picture-123a.jpg Meta%-3.1f.txt Meta123.txt
For %d, the field width/position specifiers may be applied to the directory levels instead of substring position by using a colon instead of a decimal point in the format specifier. For example:
Source Dir Format Result Notes
------------ ------ ---------- ------------------
pics/2012/02 %2:d pics/2012/ take top 2 levels
pics/2012/02 %-:1d pics/2012/ up one directory level
pics/2012/02 %:1d 2012/02/ ignore top level
pics/2012/02 %1:1d 2012/ take 1 level after top
/Users/phil %:2d phil/ ignore top 2 levels
(Note that the root directory counts as one level when an absolute path is used as in the last example above.)
Hi Don,
The substring feature for %d, %f and %e (documented under the -w option) was not what I was using here.
I was using the "advanced formatting feature" (documented under the -p option, and referenced from the -tagsFromFile option). This formatting can be applied to any tag, not just the file name, and is applicable when copying tags with "<", and when using the -p and -if options.
The specifics of the advanced formatting feature are not discussed in detail because any Perl expression may be used.
- Phil
Many thanks again, so I will have to learn some Perl syntax :-)
Don