how to use tag $model in filename and directory name?

Started by liwa, December 23, 2012, 08:41:57 PM

Previous topic - Next topic

liwa

Hi
I'm trying
1- to rename by model and datetimeoriginal
2- to sort by model and year
like that

MX-700
1999
   1999-01-02
     MX-700-1999-01-01 17-05-12 DSC0115.JPG

former Fujifilm MX700 :)


The command
"d:\Portable apps\exiftools\exiftool.exe" -r  "-Filename<$model $DateTimeOriginal" -d "%Y-%m-%d\%Y-%m-%d %H-%M-%S %%f.%%e" dir
give :

MX-700 1999-01-02
1999-01-01 17-05-12 DSC0115.JPG


The command
  "d:\Portable apps\exiftools\exiftool.exe" -r  "-Filename<$model\$DateTimeOriginal" -d "%Y-%m-%d\%Y-%m-%d %H-%M-%S %%f.%%e" dir
give

MX-700
1999-01-02
     1999-01-01 17-05-12 DSC0115.JPG

that's nice but I don't understand how it works
and I would like to include the tag "model" in the filename not only the directory name


How to rename file as  MX-700-1999-01-01 17-05-12 DSC0115.JPG
Why option -o is impossible in each command above?
How to do the same in one path?

I don't understand the correct way to use $model

Thank you very much

Phil Harvey

This is closer:

"d:\Portable apps\exiftools\exiftool.exe" -r  "-Filename<$model\$DateTimeOriginal" -d "%Y\%Y-%m-%d\%Y-%m-%d %H-%M-%S %%f.%%e" dir

and gives

MX-700
1999
   1999-01-02
      1999-01-01 17-05-12 DSC0115.JPG


But adding the model name to the file name is tricky.  The easiest way is to do it with a second command:

"d:\Portable apps\exiftools\exiftool.exe" -r  "-Filename<$model-%f.%e" -if "$filename !~ /^$model/" .

This will add the model name to any file that doesn't already start with the model name.

There is a way to do this in a single step, but it is a bit more complicated because it requires creating a user-defined tag.

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