Photo Organization Recipe

Started by venky80, November 11, 2014, 09:35:49 PM

Previous topic - Next topic

venky80

I just discovered this wonderful tool. I am wondering how I can copy files from a directory and organize them into folder structures //YYYY/YYYY-MM/CameraName_YYYY-MM-DD-hh-mm-ss_OriginalImageName.jpg
YYYY=Original Created Year
YYYY-MM = Original created year month
YYYY-MM-DD-hh-mm-ss=Original created full date time

For MOV (iphone) files I think there are no original created time so i would probably use Modify date

I am also wondering if there is a recipe section where people have posted their photo organization scripts.


Not sure where I am going wrong


C:\Users\ACME>exiftool -k -r  -o dummy/ -d "\Users\ACME\Pictures\Test\%Y/%
Y-%m\" "-Directory<DateTimeOriginal" "-filename<${model;}_${DateTimeOriginal}_%f
.%e" \Users\ACME\Pictures\2014


I am getting no files to process

I am not able to quite understand how to set the parent directory if i play with removing filename the pics go to Syswow folder . how do i make sure the parent folder and new organized folder both are under pictures

Phil Harvey

Quote from: venky80 on November 11, 2014, 09:35:49 PM
I just discovered this wonderful tool. I am wondering how I can copy files from a directory and organize them into folder structures //YYYY/YYYY-MM/CameraName_YYYY-MM-DD-hh-mm-ss_OriginalImageName.jpg

The complication is that you want the camera name in between two different date/time formats.  To do this, it is easiest to do it in 2 steps:

1) Rename the file (the quoting below is for Windows, use single quotes instead on Mac/Linux):

exiftool -d "%Y-%m-%d-%H-%M-%S" "-filename<${model;}_${datetimeoriginal}_%f.%e" DIR

2) Move the file:

exiftool -d "/Users/ACME/Pictures/Test/%Y/%Y-%m/" "-directory<datetimeoriginal" DIR

QuoteI am getting no files to process

Do the files contain DateTimeOriginal?  (try "exiftool -datetimeoriginal FILE" to see)

QuoteI am not able to quite understand how to set the parent directory if i play with removing filename the pics go to Syswow folder . how do i make sure the parent folder and new organized folder both are under pictures

I don't understand.

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

venky80

#2
Thanks Phil. I guess I was trying to do it all in one shot and was not quite understanding the difference between -directory flag and -filename flag . I thought I read -filename can also change directory? That is what was confusing.

I also would like to copy rather than move  the files from the parent location to parent/test/ with YYYY/YYY-MM folder structure.

the -o flag can also pass directory which is also confusing.

I still think this is going to be a godsend for Pic/media organisation.

Thanks for your help

P.S in some post i saw this exiftool.exe -d "%Y%m%d_%H%M%S%%-c.%%e" "-filename<filemodifydate" "-filename<datetimeoriginal" FILE/DIRECTORY

Yes all pics contain datetime original. I guess at some point I would like to deal with missing tags in MOV files but pictures are my first priority :)

Phil Harvey

Quote from: venky80 on November 12, 2014, 07:02:52 PM
I thought I read -filename can also change directory?

Yes it can, but you can't put the value of a tag in the middle of the -d formatting argument, so in this case it was easiest to split them up.

QuoteI also would like to copy rather than move

Add "-o dummy/" to the command.

Quotethe -o flag can also pass directory which is also confusing.

Yes.  Read more about this on the filename page.

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

venky80

#4
i guess the 2 command is the easiest solution probably  :-\..was wondering if there was a straight command

Phil Harvey

There is are ways to do this in a single command, but they are more advanced.  Here is one example:

exiftool -d "%Y-%m-%d-%H-%M-%S" "-filename</Users/ACME/Pictures/Test/${datetimeoriginal#;s/:.*//}/${datetimeoriginal#;s/:/-/;s/:.*//}/${model;}_${datetimeoriginal}_%f.%e" DIR

Here I have taken the unformatted value for DateTimeOriginal by adding a "#" after the tag name, then reformatted it manually for the directories using advanced formatting expressions.

Here is a thread that does a similar thing.

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

venky80

Awesome :) Thanks Phil.
I am able to use this to exactly do what i want.

venky80

Ok I got almost everything i want except i have a command preference issue


exiftool -k -r -d "%Y-%m-%d-%H-%M-%S"
"-filename</Users/ACME/Pictures/Test5/${FileModifyDate#;s/:.*//}/${FileModifyDate#;s/:/-/;s/:.*//}/ACME_iPhone4_${FileModifyDate}_%f.%e"
"-filename</Users/ACME/Pictures/Test4/${ModifyDate#;s/:.*//}/${ModifyDate#;s/:/-/;s/:.*//}/ACME_iPhone4_${ModifyDate}_%f.%e"
"-filename</Users/ACME/Pictures/Test3/${ModifyDate#;s/:.*//}/${ModifyDate#;s/:/-/;s/:.*//}/ACME_${model#;s/ //}_${ModifyDate}_%f.%e"
"-filename</Users/ACME/Pictures/Test2/${ContentCreateDate#;s/:.*//}/${ContentCreateDate#;s/:/-/;s/:.*//}/ACME_${model#;s/ //}_${ContentCreateDate}_%f.%e"
"-filename</Users/ACME/Pictures/Test1/${datetimeoriginal#;s/:.*//}/${datetimeoriginal#;s/:/-/;s/:.*//}/$ACME_{model#;s/ //}_${datetimeoriginal}_%f.%e"
"/Users/ACME/Downloads/Test/"


basically i am intending to move from downloads/test

to
pictures/test1 (all files with datetime original and model after removing space)
pictures/test2 (remaining files with contentcreatedate for original mov files)
pictures/test3 (remaining files with model info but no datetime original or contentcreatedate )
pictures/test4 (rest of the remaining which has modify date but no model info, manually putting model info)
pictures/test5 (rest of the files manualy putting model info)


I am not finding anything in /test1 isnt the last command 1st preference?

Phil Harvey

You have a "$" before "ACME" instead of before "{model" that is causing the problem for your Test1 argument.

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

venky80

arrgh!..thanks for the keen eye. I might have my final command :)