If this site goes down it is because of the crappy DreamHost web hosting: They will disable your "unlimited traffic" web server if a single bot hammers the site with a moderate load.  If necessary, an alternate ExifTool forum page is available at

Main Menu

Sorting into folders

Started by exifnewbee, November 28, 2022, 11:30:39 AM

Previous topic - Next topic


I use the following command to sort a large number of photos into directories.

Idea is to use sorted for files that have date/time info in metadata and dir nodate for anything else.

I've applied this command to a directory (with subdirs and many files), but a few files are left in their original (sub-)dir and are not sorted into either sorted or nodate and I can't find any reason why that is the case.

Here is the command I use:
exiftool -d %Y/%m '-filename<nodate/$FileModifyDate/%f%-c.%le' '-filename<nodate/$FileModifyDate/${model;}/%f%-c.%le' '-filename<sorted/$ModifyDate/%f%-c.%le' '-filename<sorted/$ModifyDate/${model;}/%f%-c.%le' '-filename<sorted/$CreateDate/%f%-c.%le' '-filename<sorted/$CreateDate/${model;}/%f%-c.%le' '-filename<sorted/$DateTimeOriginal/%f%-c.%le' '-filename<sorted/$DateTimeOriginal/${model;}/%f%-c.%le' -r -P -ee 2 srcdir > sorting_result.txt 2>&1
Since all files that do not get moved are either .avi or .mpg I had added the -ee 2 statement above, hoping it would parse from some of the embedded metadata, but no change...

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).