Alley in Pisa, Italy

by Lars Kotthoff

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

I use ExifTool to batch rename all of my pictures using the following two commands:

"-FileName<${Exif:Model}-(%%f).%%e"
-d %%Y%%m%%d-%%H%%M%%S-%%%%f.%%%%e "-FileName<DateTimeOriginal"

This gives me filenames such as:

20110711-144637-DMC-FZ28-(P1020103).JPG

and

20110711-145144-iPhone 4-(IMG_1004).JPG

I have been sent some of pictures taken with a Samsung S860 which has a Model tag of <KENOX S860 / Samsung S860>

I'm not sure if it is ExifTool (v8.60) itself or the Windows (7 64-bit) command shell which is doing it, but the first command is treating the / as a directory change and gives an error when trying to execute:

Warning: Error creating directory for '<KENOX S860  / Samsung S860>-(SDC12529).JPG' - D:/Users/xxx/Desktop/ExifProcess/SDC12529.JPG
Error creating directory <KENOX S860

Is there any way to force ExifTool to escape the forward slash character?

I have tried the -ex and -E options which do encode the < and > but not the /.

Is there any way of forcing ExifTool to not treat the / as part of the path?

Below is the full process.bat file that I use:

@Echo Off
MD D:\Users\xxx\Desktop\ExifProcess
COPY D:\Users\xxx\Pictures\Import\*.jpg D:\Users\xxx\Desktop\ExifProcess
"P:\Program Files (x86)\ExifTool\exiftool.exe" "-FileName<${Exif:Model}-(%%f).%%e" D:\Users\xxx\Desktop\ExifProcess\*.jpg
"P:\Program Files (x86)\ExifTool\exiftool.exe" -d %%Y%%m%%d-%%H%%M%%S-%%%%f.%%%%e "-FileName<DateTimeOriginal" D:\Users\xxx\Desktop\ExifProcess\*.jpg
Pause
share|improve this question
    
Consider the following workflow: (1.1) loop through the photo folder alphabetically (1.2) output each photo's Exif:Model to a text file (2) loop through the text file replacing / as e.g. - (3.1) loop through the photo folder alphabetically again (3.2) rename files according to the modified text file –  koiyu Jul 12 '11 at 11:29
    
@koiyu: see my answer below — same thing, but no need for an intermediate text file (or for two passes). –  mattdm Jul 12 '11 at 13:09
add comment

4 Answers 4

Using exiftool, the answer is to create a user-defined tag based on EXIF:Model which filters out the offending characters. This question is asked and answered in the ExifTool forum:

http://u88.n24.queensu.ca/exiftool/forum/index.php/topic,2961

share|improve this answer
add comment

I've been using jhead for this since before I was aware of this feature of ExifTool, and what I do is simply use a wrapper script to

  1. extract the model name to a temporary variable
  2. munge the name using a set of rules I've built up
  3. rename using that variable in the shell command line rather than the string codes for the rename tool itself

This is a little bit kludgy, but hey, kludges are what shell scripts are for in the first place, right? And it has the advantage of dealing with other weird model names like Pentax's terribly-labeled "*ist" series. And you're already using a batch script. Just put a little bit more smarts into that level.

share|improve this answer
    
True, but not really very helpful for Windows-using photographers who are rarely proficient in shell scripting. –  che Jul 12 '11 at 21:00
    
They've got PowerShell, right? It's not that scary. :) –  mattdm Jul 13 '11 at 19:37
add comment

Try this:

exiftool '-FileName<${CreateDate}_${Exif:Model}.jpg' -d %Y%m%d_%H%M%S-%%2c *

or this

exiftool '-FileName<${CreateDate}_${Exif:Model}_${filename}' -d %Y%m%d_%H%M%S *
share|improve this answer
2  
Perhaps you could add some comment to explain how you came up with these commands, and what the differences between them are? –  Edd Oct 5 '12 at 9:54
add comment

So far the only answer I have come up with is to add

-overwrite_original_in_place -preserve "-Model=Samsung S860"

as the first ExifTool action, but this obviously changes the file itself, rather than just the file name.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.