Replicating w/exiftool Lightroom Import, Move & Rename Sequence

Started by clem, December 05, 2019, 02:34:20 AM

Previous topic - Next topic

clem

I'm trying to reduce my reliance on Lightroom's file handling routines... but my efforts so far at doing this with exiftool aren't going so well

I'd like to be able to get exiftool to filter and rename and organize the NEF, CR2, JPEG, JPG and HEIC files from a straight file copy dump on a hard drive folder (called "Macintosh HD:SD card pics")  into a hierarchical folder... with the files named by time and organized in a nesting order

Final sequence would result in a  folder hierarchy like this:

2019
-----11
--------14


and all individual files renamed to the millisecond to account for high frame rate captures with more than one photo taken within a single second.
YYYY-MM-DD-HHMMSS-MS

2019-11-14-143821-21.NEF

So ultimately the resulting file would be nested as:

Macintosh HD:Pictures:2019:11:14:2019-11-14-143821-21.NEF

thanks for any tips!

StarGeek

Try something like this
exiftool -d '%Y/%m/%d/%Y-%m-%d-%H%M%S' '-Filename</path/to/Pictures/${DateTimeOriginal}-${SubSecTimeOriginal}.%e' /path/to/SDCard/
* 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).

Phil Harvey

I would add -o . to the command so files are copied instead of moved.  I don't think it is a good idea to delete stuff from an SD card -- instead, format the card in the camera once you are sure all of the files have been transferred OK.

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

clem

Thank you to both of you for your help... I have managed to piece together two exiftool sequences that do the trick based upon your combined suggestions, however, is there a way I can do this with a single command?

exiftool -o . '-Directory<CreateDate' -d /Users/Shared/TestEXIF/Sorted/%Y/%m/%d -r /Users/Shared/TestEXIF/Source/

and then after cd'ing into the /Users/Shared/TestEXIF/Sorted/ folder issuing this:

exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" .

I'm hoping that this can be combined into a single line.

The only caveat I see is that this doesn't include the SubSecTimeOriginal ... when I do that, some of the files which do NOT have sub-second times are error'ed out because they would be duplicates of the preceding file in the sequences. I don't know how to workaround this, so the above was the best option I could come up with.

Thoughts?

Thanks in advance!

Phil Harvey

Did you use DateTimeOriginal for the file name, and CreateDate for the directory on purpose?

If you could use the same tag for both, you can do this:

exiftool -o . "-FileName<DateTimeOriginal" -d "/Users/Shared/TestEXIF/Sorted/%Y/%m/%d/%Y-%m-%d %H.%M.%S%%-c.%%e" -r /Users/Shared/TestEXIF/Source/

...otherwise it gets a bit more complicated.

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

StarGeek

Try this

exiftool -o . -r -d '%Y-%m-%d %H.%M.%S' '-Filename</Users/Shared/TestEXIF/Sorted/${CreateDate;DateFmt("%Y/%m/%d")}/${DateTimeOriginal}%-c.%e' '-Filename</Users/Shared/TestEXIF/Sorted/${CreateDate;DateFmt("%Y/%m/%d")}/${DateTimeOriginal}-${SubSecTimeOriginal}%-c.%e' /Users/Shared/TestEXIF/Source/

Files that do contain SubSecTimeOriginal will be processed by the second part while files that don't are processed by the first part.  The %-c should add a copy number in cases where there would be duplicate filenames.

I moved the %c and %e out of the -d (dateFormat) option format string so that removes the extra percent sign on those two variables.  The DateFmt helper function is an Advanced formatting feature.
* 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).

Phil Harvey

...but I didn't notice you wanted subseconds.  StarGeek reads more thoroughly than I do. ;)

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

clem

You two are incredible.

I'm in awe.

Such fast replies and darnnitall.... it works great! :-)

Thank you very much!  :)