ExifTool Forum

ExifTool => Newbies => Topic started by: daboss on April 05, 2018, 02:51:28 AM

Title: combine filename and directory
Post by: daboss on April 05, 2018, 02:51:28 AM
Hi

Would someone be so kind to help me combine my two step into one. Currently I have the following. First command renames files and copies into a new directory. Second command works with this copy of renamed files and then copies into a new structure based on Year/Month.

exiftool -r -P -ext .jpg -d '%Y%m%d-%H%M%S-%%f.%%e' '-filename<filemodifydate' '-FileName<DateTimeOriginal'  -o '/PhotoEXIFRename'  '/PhotosSource/'

exiftool -P -ext .jpg  -o '/PhotoEXIFSorted/Unsorted/'  -d /PhotoEXIFSorted/%Y/%m\ %B '-directory<filemodifydate' '-Directory<CreateDate' '-directory<datetimeoriginal' -r '/PhotoEXIFRename'


Thank-you

Title: Re: combine filename and directory
Post by: Phil Harvey on April 05, 2018, 07:03:55 AM
All you have to do is add the final directory to the desired file name in the first command:

exiftool -r -P -ext .jpg -d '/PhotoEXIFSorted/%Y/%m\ %B/%Y%m%d-%H%M%S-%%f.%%e' '-filename<filemodifydate' '-FileName<CreateDate'  '-FileName<DateTimeOriginal'  -o '/PhotoEXIFRename'  '/PhotosSource/'

Here I have also added the CreateDate argument that was missing from the first command.

See example 11 on the Setting FileName page (https://exiftool.org/filename.html#ex11) for more information about the precedence of the various ways of specifying the directory.

- Phil
Title: Re: combine filename and directory
Post by: daboss on April 06, 2018, 08:21:21 AM
Thank-you Phil! Getting my head around it now. Great product, well done.