concatenating old directory in new directory name

Started by phani, November 20, 2012, 04:04:06 PM

Previous topic - Next topic

phani

Is there a way to concatenate an old directory into a new directory name

I am trying to do the following
"exiftool(-k).exe"   -r -d "test_dest/%Y/%m/%%d-%d/%%f-%%c.%%e" "-Directory<DateTimeOriginal" test_src

Input:
test_src/a_dir/a.jpg

Expected output:
test_dest/YY/MM/a_dir-DD/a.jpg

Current output
test_dest/YY/MM/a_dir/-DD/a.jpg

Is there a way to avoid getting the extra slash in %%d ? it  is creating an extra directory for me

Thanks
Phani

Phil Harvey

Hi Phani,

If the only problem is removing the trailing "/", this can be done with %-.1d

There are lots more options for returning components of the directory.  See -w in the application documentation for details.

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

phani

Hi Phil
Thanks for the prompt reply. Not sure how to use -w with "filename<createdate" : I thought -d is te one to use to direct date formatting.

I have a related question.

I am trying to move photos from a deep recursive directory into  a simpler structure
destination/YEAR/YEAR-MONTH-DAY original-directory-where-picture-was-found/original filename-count.original extension

I created a bat file which accepts 2 params - src directory &dest dir
"exiftool(-k).exe"  -r -d "%2/%%Y/%%Y-%%m-%%d %%%%d/%%%%f%%%%-c.%%%%e" "-filename<CreateDate"  %1

when I run this with src as \test\a_dir\b_dir & target as FINAL
I get the following errors for all pictures
Error creating directory FINAL/2012/2012-05-05 /test
Warning: Error creating directory for 'FINAL/2012/2012-05-05 /test/a_dir/b_dir/D
SC_9117.JPG' - /test/a_dir/b_dir/DSC_9117.JPG

Is there a way to get just the parent src directory name (1 level up) where the photo was found to append to the target dir name?

Also, is there a way to instruct exiftool to operate only on all photos (jpg / raw) instead of all recognized types including pdfs?

Thanks
Phani

Phil Harvey

Hi Phani,

Quote from: phani on November 25, 2012, 04:21:42 PM
Not sure how to use -w with "filename<createdate" : I thought -d is te one to use to direct date formatting.

I wasn't suggesting that you use -w, but that section explains the details of the format codes like %d which are common to different options.

QuoteIs there a way to get just the parent src directory name (1 level up) where the photo was found to append to the target dir name?

Yes.  This is explained in the documentation I mentioned above.

QuoteAlso, is there a way to instruct exiftool to operate only on all photos (jpg / raw) instead of all recognized types including pdfs?

Yes.  See the -ext option.

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