sort by camera model, no renaming

Started by jlocicero, July 09, 2018, 01:31:58 PM

Previous topic - Next topic

jlocicero

How can I sort a directory of images and video files by camera model, without renaming the files?

I would like the end result to have new folders for each camera model in the same folder I perform the command on.

Thanks for your help!

StarGeek

Try this test command to see if it would copy to the correct directory
exiftool "-Testname<%d/${Model;}" DIR

If the output is what you want, then run this command
exiftool "-directory<%d/${model;}" DIR
* 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).

jlocicero


jlocicero

I was going to ask how to add to this command to adjust the creation and modification dates of the files to the time and date the picture or video was taken, but I managed to make it work. Still, can you see any problems with this command?

exiftool -overwrite_original_in_place '-filemodifydate<datetimeoriginal' '-createdate<datetimeoriginal' -r '-directory<%d/${model;}' DIR

Thanks!

Phil Harvey

Which creation date do you want to change?  The filesystem creation date/time is FileCreateDate.  I don't think you should be writing CreateDate (which is metadata in the file).  And if you just set FileModifyDate, FileCreateDate and Directory, then you don't need -overwrite_original_in_place because the file will not actually be written (only filesystem information will be changed).

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

jlocicero

Thank you Phil, you are quite right. I was having a lot of trouble with my original command, and now I see it was because I was changing CreateDate. Using FileCreateDate instead of CreateDate fixed it.

I get the following error for each file, though, but it still works: "Warning: This tag is Windows only in File:FileCreateDate (ValueConvInv)"

Here is my new command:

exiftool '-filemodifydate<datetimeoriginal' '-filecreatedate<datetimeoriginal' -r '-directory<%d/${model;}' DIR

One more thing and this would be perfect. Before sorting, several files in my directory have " 1" appended to them because they have the same filename as another file. For example, the directory contains the files "IMG_2132.JPG" and "IMG_2132 1.JPG" which are different pictures, taken with different cameras. Sorting the files into camera folders helps, but it would be even better if I could remove the " 1" from the filenames after they are sorted into the folders.

How could I add this to my command? Then I'd have a single command that would do everything in one operation!

Phil Harvey

Quote from: jlocicero on July 10, 2018, 10:51:43 PM
"Warning: This tag is Windows only in File:FileCreateDate (ValueConvInv)"

Update your version of ExifTool.  This tag is now writable on Mac and Windows.

Quoteit would be even better if I could remove the " 1" from the filenames after they are sorted into the folders.

I don't know how you managed to have a space before the "1", but this command will remove a space followed by any digit after "IMG_####" in a file name:

exiftool "-filename<${filename;s/(IMG_\d{4}) \d}" 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 ($).

jlocicero

I've updated my ExifTool to 11.06 on Mac, and most of the errors have stopped. I still get errors on MOV files:

Warning: [minor] The ExtractEmbedded option may find more tags in the movie data

It still does the job, though.

QuoteI don't know how you managed to have a space before the "1"...

This is a result of using Image Capture on the Mac to download photos from iPhones and cameras. If files from two cameras or phones have the same names and are downloaded to the same directory, the second one has " 1" appended to it. There was a time when my phone and my wife's phone were nearly in sync for file numbers, and I'm correcting it now.

Thank you very much for your help!