3

An example of starting directory structure,

\best camping trip ever\ <-parent directory referred below
      \from my cell phone\
      \from my camera\
      \Johns camera\
      \Cindys camera\

Now if I run this command,

exiftool "-directory<EXIF:DateTimeOriginal" -d %Y%m%d -r .

while being in parent directory exiftool will make folders based on dates and will sort the images in them. I would prefer to do something like this,

\20151020\from my cell phone\
         \from my camera\
         ...
\20151021\from my cell phone\
         \...
         \Johns camera\
         ...

you get the point. To keep the original structure, so I have an idea from what device and/or person images in question came from.

Is this something that is possible?

1

Make sure the parent directory is your current directory and you can use this command:
exiftool "-directory<EXIF:DateTimeOriginal" -d "%Y%m%d/%%d" -r .

Example, given this tree \f for the current directory, then running the above command, gives the end result:

X:\!temp\test>tree /f
Folder PATH listing for volume Data
Volume serial number is 00000200 1CFF:E96C
X:.
│   20140404_040404.jpg
│   20150303_030303.jpg
│   
└───2010
    └───12
        └───25
                Test.jpg


X:\!temp\test>exiftool  -d "%Y%m%d/%%d" "-directory<DateTimeOriginal"  -r .
    4 directories scanned
    3 directories created
    3 image files updated

X:\!temp\test>tree /f
Folder PATH listing for volume Data
Volume serial number is 00000200 1CFF:E96C
X:.
│   
├───2010
│   └───12
│       └───25
├───20101225
│   └───2010
│       └───12
│           └───25
│                   Test.jpg
│                   
├───20140404
│       20140404_040404.jpg
│       
└───20150303
        20150303_030303.jpg

Test.jpg still retains the 2010/12/25 path under the new directory. Also note that the original directory is not removed.

The addition of %%d escapes the last %d so it is interpreted as the directory from the -w option instead of the date from the -d option.

This command will result in different results if you aren't using the current directory. If the current directory is on a different drive than the target directory, then you will most likely get an error as it tries to append the target directory name onto the current directory, something like c:\CurrentDir\D:\TargetDir. If this needs to be done, then look into the %d options under the -w option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.