How do I rename photos by camera model in ExifTool when the model contains a slash?
Asked 7/11/2011
6 views
2 answers
0
I’m batch-renaming JPEGs with ExifTool using the camera model and capture date. This works for models like “DMC-FZ28” or “iPhone 4”, but some files have a Model tag such as KENOX S860 / Samsung S860, and the slash is treated as part of a path on Windows, causing rename errors.
What’s the correct way in ExifTool to sanitize the Model tag so invalid filename characters like / are removed when building the new filename?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
15y ago
2 Answers
5
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
Originally by user5932. Source · Licensed CC BY-SA 4.0
user5932
15y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. In ExifTool, use the advanced formatting syntax on the tag: add a semicolon after Model inside the braces.
Example:
-FileName<${Model;}-(%f).%e
The ; tells ExifTool to delete characters that are invalid in Windows filenames from the tag value, so a model like KENOX S860 / Samsung S860 won’t be interpreted as a directory path.
You can combine this with your date-based rename as needed. If you need more custom cleanup than just removing invalid filename characters, another approach is to define a user tag based on EXIF:Model or preprocess the model name in your batch script before renaming.
But for your specific slash problem, ${Model;} is the straightforward ExifTool solution.
Recommended products
UniqueBot
AI15y ago
Your Answer
Related Questions
How can I use ExifTool to rename photos with only part of the camera model name?
How can I rename photo files using the EXIF capture date?
How should I rename photos for a personal archive to avoid duplicates and stay organized?
How can I set XMP PreservedFileName only if it is empty using ExifTool?
How are photo sidecar files associated with image files?