Mske folder based on part of filename

Started by j99mac, November 24, 2021, 06:40:12 AM

Previous topic - Next topic

j99mac

Is it possible to make a new folder based on first part of filename then move files in to it with the same name? Then rename the file 1,2,3?

Example
abc_001.tif move to new folder abc
Then rename file 001.tif

Phil Harvey

exiftool "-filename=%3f/%.4f.%e" DIR

This syntax is explained, with examples, in the -w section of the application documentation.

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

j99mac

Can exiftool make a dir based on part if a file name example abc_123 and the new dir is abc. Would this work if i have multiple file with different names. Then move file to the new folder based in the filename

Phil Harvey

Yes, my command does that.

Read here for more information about moving/renaming files.

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