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

-d %%Y%%m%%d-%%H%%M%%S-%%%%f.%%%%e "-FileName<DateTimeOriginal"

This gives me filenames such as:



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
  • \$\begingroup\$ 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 \$\endgroup\$ Commented Jul 12, 2011 at 11:29
  • \$\begingroup\$ @koiyu: see my answer below — same thing, but no need for an intermediate text file (or for two passes). \$\endgroup\$
    – mattdm
    Commented Jul 12, 2011 at 13:09

5 Answers 5


Although this has been asked some time back, but since no response is marked as Answer I offer this.

Maybe the solution is to use the semicolon behind the Model to remove invalid characters > model;

exiftool '-filename<%f_${model;}.%e' dir

Rename all files in dir by adding the camera model name to the file name. The semicolon after the tag name inside the braces causes characters which are invalid in Windows file names to be deleted from the tag value (see the "Advanced formatting feature" for an explanation).

Source: ExifTool documentation and this question


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:



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.

  • \$\begingroup\$ True, but not really very helpful for Windows-using photographers who are rarely proficient in shell scripting. \$\endgroup\$
    – che
    Commented Jul 12, 2011 at 21:00
  • 1
    \$\begingroup\$ They've got PowerShell, right? It's not that scary. :) \$\endgroup\$
    – mattdm
    Commented Jul 13, 2011 at 19:37

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 *
  • 2
    \$\begingroup\$ Perhaps you could add some comment to explain how you came up with these commands, and what the differences between them are? \$\endgroup\$
    – Edd
    Commented Oct 5, 2012 at 9:54

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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