Renaming and sorting by date AND Camera Make and Model

Started by rkrug, September 14, 2013, 08:15:28 AM

Previous topic - Next topic

rkrug

Hi

I am using the following script to sort my images:

    #!/bin/sh
    for f in "$@" 
    do
       exiftool -r -d ~/Pictures/test/%Y/%m/%Y.%m.%d_%H.%M.%S.%%e "-filename<$Exif:CreateDate" "$f"
    done


But I would like to add the camera Make and Model at the end of the new name.
I tried

       exiftool -r -d ~/Pictures/test/%Y/%m/%Y.%m.%d_%H.%M.%S.%%e "-filename<$Exif:CreateDate___Make.Model" "$f"


but it did not work.

Any suggestions?
Thanks,

Rainer

Phil Harvey

Hi Rainer,

On Mac/Linux you need to use single quotes instead of double quotes if the argument contains a dollar sign.  Also, you probably want the %e at the end.  So try this:

exiftool -r -d ~/Pictures/test/%Y/%m/%Y.%m.%d_%H.%M.%S '-filename<${Exif:CreateDate}___$Make.$Model.%e' ...

I'm not sure why you are looping an a bash for loop.  You can put multiple file names and/or directory names on the exiftool command line, and this is much faster than launching exiftool repeatedly for each file.

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


nukhem

Hi,

I would like to do the same to all *.x3f files in the current working directory. I have 2 sigma camera's, dp1m & dp2m (different focal length fixed lenses)

so for test i have 2 x3f files (one of each camera) in a directory along the exiftool.exe:

dp1m001.x3f
dp2m001.x3f

What command do i have to do to get an output like this

2014-03-14 14h23m18s Sigma DP1 Merrill.x3f
2014-03-12 23h18m13s Sigma DP2 Merrill.x3f
2014-03-12 23h18m13s Sigma DP2 Merrill-002.x3f (for when i do bracketing: multiple files @ same second)

Please help, i tried hundreds of commands already without success. OP's example is the closest to what i want but he's using linux so his commands aren't working also. I'm using windows

thanks in advance

Phil Harvey

The difference in Windows is that you need to use double quotes instead of single quotes:

exiftool -r -d "%Y-%m-%d %Hh%Mm%Ss" "-filename<${Exif:CreateDate} ${Model;}%-3nc.%e" DIR

Here I also changed the command to do the formatting you indicated, including filtering the Model string to be sure there are no illegal characters.

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

nukhem


nukhem

I've been using this command for the past months with great succes. Would it be possible to adjust it so that it shows exposure compensation value in the resulting filename? That would make my life easier trying to filter out bracketed photos.

Thank you

StarGeek

Try adding ${ExposureCompensation} to where you want it to show up in the filename. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

yaid

I too want to rename and sort by date AND Camera Make and Model BUT sometimes, in case of images received from whatsapp, there are no EXIF data in them....
So here is what I am looking for:
If there is EXIF date picture taken and EXIF Camera Make and Model, I want my pictures to be moved to
YYYY_MM_DD/CameraMake_Model_OriginalFileName.jpg where YYYY_MM_DD and CameraMake_Model are coming from the EXIF data

If there are no EXIF data, I want my pictures to still be moved to
YYYY_MM_DD/OriginalFileName.jpg where YYYY_MM_DD is the file creation date

My pictures are all over my computer, so I would like to be able to specify from which folder it should start searching for pictures and then specify to which folder it should move them (and under that folder it would be the YYYY_MM_DD folder structure).

I am on a MAC.

HELP !

Phil Harvey

Try this:

exiftool -d %Y_%m_%d '-filename<${filemodifydate}/%f.%e' '-filename<${datetimeoriginal}/${make;}_${model;}_%f.%e' DIR

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

snappyhappy

 Hi,
firstly may I say that I'm stunned that the author of such a brilliant tool responds to queries from users, if only Mr Gates did the same I may still be using Windows (assuming its finished installing updates).  Anyway just a quick question. I've managed to scan through images and sort them into hierarchical directories, I've also switched that to create directories on camera model using [exiftool -d -%f.%e '-directory<$model' $my_dir].
I see there is guidance on how to "rename images" with date and model and that works fine.
MY Aim.
I want to create a directory that is named [year/month/day -model] or [model-date hierarchical folders ( still want the subordinate folder with the full date yy/mm/dd]     or something along those lines.

I've contemplated using Exiftool to pull that info then concatenate in Python or Bash then loop through the Dirs but I'm lead to believe that this tool is a Workshop not a tool and its bad form to just to use it to pull data. Is it possible to define my tags and how simple is this for a novice. 

ps
The registration form is quite cunning, it's almost a mini test on using the site.

StarGeek

Quote from: snappyhappy on September 05, 2019, 06:33:48 PM
its bad form to just to use it to pull data.

I wouldn't call it bad form, it's just a bad idea.  The startup time is exiftool's biggest performance hit.  If you're looping though hundreds, if not thousands of images, you'll find that calling exiftool once for each image can take an extremely long time.  If you let exiftool take care of the batch processing there will be a significant reduction in processing time.

QuoteI want to create a directory that is named [year/month/day -model] or [model-date hierarchical folders ( still want the subordinate folder with the full date yy/mm/dd]     or something along those lines.

If you can be more specific, I can help you better with the command.  But here are some pointers.

If the hierarchy is to be some form of Date-Model-Date, then the best bet is to use the DateFmt helper function from the Advanced formatting feature.  This is because the -d (dateFormat) option cannot include another tag in the middle of it.  You can find the date codes used for both under Common Date Format Codes.

Whenever you use the Make or Model tags in a filename, it's often a good idea to use the ${Make;}/${Model;} version of the tags.  This will remove some characters which would be illegal in filenames under Windows (not sure about Mac/Linux).

More details and examples can be found on the Writing "FileName" and "Directory" tags page
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

snappyhappy

Hi Stargeek,
Thanks for your help and advice, I think it's too deep for me at the moment. I'm just going to run a bash script to create the camera model folders then the date hierarchy.