Need help making script to do sort pics into folders by YEAR-MONTH-DATE.

Started by xdajzax, November 27, 2024, 08:04:35 PM

Previous topic - Next topic

xdajzax

I'm glad i found this forum. Please excuse me. I'm not computer saavy at all and need instructions like I'm an idiot.

I have a folder "DCIM" in path Users/johnparkmd/pictures/DCIM in my MAC HD and also Copied on my Synology NAS as Network/PARKDISK/Photo/DCIM.

DCIM has subfolders with pics in them named 152ND750, 153ND750, etc.

I need to sort all the pics in the DCIM folder by YEAR-MONTH(subfolder)-DATE(subfolder of MONTH). I can either do this in my MAC then transfer to my NAS or just do in NAS.

Sadly, I can do neither of these. I have managed to install ExifTool on my MAC but not my NAS. I tried some scripts I found on this forum and got lost and frustrated.

Please help. Again, please reply as if I am an idiot in these things. I'm pretty proud I managed to install Exiftool but that's not even the beginning of things to do. Thanks in advance.

Phil Harvey

The command you would type in a Terminal window could be something like this:

exiftool -r -o . '-directory<createdate' -d ~/pictures/sorted/%Y-%m/%d ~/pictures/DCIM

To explain a few things:

"~" in the Mac Terminal is short form for your home directory name (ie. "/Users/johnparkmd"), but it must not be quoted or the Terminal won't recognize it.

Are you sure it is "pictures" and not "Pictures"?  Mac systems are typically case sensitive.

'-directory<createdate' sets the directory name from the contents of the CreateDate tag in each file.

The -o . causes the images to be copied.  If this is omitted, the images will be moved instead.

Here I'm assuming you want a final directory name like "/Users/johnparkmd/pictures/sorted/2024-11/27", but you can change this with the -d option argument. See here for a list of date/time formatting codes.

The -r recurses all subdirectories in the source DCIM folder.  It will search for all files that are writable by ExifTool and process them (eg. JPG, MP4, etc).  Use "exiftool -listwf" in the Terminal to see the complete list of writable file extensions.

I use a command like this myself to copy straight from my memory card by specifying "/Volumes/Untitled" (or whatever my memory card is named) as the source folder.

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