Change Filename and Directory tags at the same time

Started by Gregorio, November 14, 2014, 10:44:38 PM

Previous topic - Next topic

Gregorio

Hi Phil. First of all let me tell you that since I met "ExifTool" a couple of weeks ago, I just loved it for its flexibility and power. Now I am organizing my collection of personal photos. I want to organize my photos by changing the file name and folder but I've encountered a small problem that I'll try to explain below.

I use the following instructions to organize my mess:

ExifTool version: 9.75

exiftool -ext '*' -r -d %Y-%m-%d_%H%M%S%%-c.%%le '-filename<${CreateDate}' '-filename<${Model}_${CreateDate}' *
exiftool -ext '*' -r -d /path/to/my/organized/files/%Y/%m/ '-Directory<CreateDate' *

However, if after executing the first instruction, I have something like the this:

path/1/LT15a_2011-11-30_214423.jpg
path/2/LT15a_2011-11-30_214423.jpg
path/3/LT15a_2011-11-30_214423.jpg
...

When I run the second command says that the file already exists.

Is there any way so that when I move files for final location, I can also use the option of adding a copy number %% c if the file already exists?

Thanks in advance

Phil Harvey

Sure.  Try this for your second command:

exiftool -ext '*' -r -d /path/to/my/organized/files/%Y/%m/%%f%%-c.%%e '-filename<CreateDate' .

Also, if you are feeling adventurous, your two commands may be combined into one using some of the advanced techniques.  See this post for an example.

- 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 ($).

Gregorio

Thanks a lot.

That's exactly what I was looking for, now I can do the entire process in a single pass:

exiftool -ext '*' -r -d %Y-%m-%d_%H%M%S%%-c.%%le \
   '-filename</path/to/my/organized/files/${CreateDate#;s/:.*//}/${CreateDate#;s/:/-/;s/.*-//;s/:.*//}/${CreateDate}' \
   '-filename</path/to/my/organized/files/${CreateDate#;s/:.*//}/${CreateDate#;s/:/-/;s/.*-//;s/:.*//}/${Model}_${CreateDate}' *