ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:08 AM

Title: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by vk1 on 2007-09-22 19:52:30-07]

Hello friends,

Sorry if it is a very basic question. I did search but didn't see any solution to my problem. I have a set of pictures in the following structure

Code:

Pictures
   2001-01-15/
        IMG-0023.jpg
        IMG-0023.jpg
        .
        .
    2002-03-10
        .
        .
    etc.
I am currently in the process of tagging and putting the -XMP:Title field in all of my images using the Windows Live Photo Gallery. Once I am done, I would like it to be organized as follows:

Code:

Pictures
    2001
        SFO Trip (The value from the XMP:Title)
            IMG-0023.jpg
            IMG-0023.jpg
        .
    2002
        .
        .
    etc.

I have tried various combinations. I am not sure how to create a directory with the title value. e.g. the command below creates a folder called "${Title}", instead of using its value:

Code:

exiftool.exe -r -o tmp/ -d %Y/${Title} "-directory<DateTimeOriginal" "C:/Documents and Settings/Administrator/My Documents/Pictures"

Also currently it is not making use of the -o tmp/ and new structure gets created in the same directory as the exiftool.exe.

Any heal is greately appreciated, as I am kinda stuck at this point.
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by exiftool on 2007-09-22 21:00:29-07]

Yes, I can see how this is a bit confusing.  The -o option
is being overridden by setting the Directory tag, so it
has no effect.  Also, the tag names aren't expanded inside the date
format string.  So try something like this instead:

Code:
exiftool -r -d %Y "-Directory<tmp/$DateTimeoriginal/$Title"  "C:/Documents and Settings/Administrator/My Documents/Pictures"

- Phil
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by vk1 on 2007-09-23 00:35:59-07]

Thanks much Phil. I used the command you suggested and it works.

Now just one more part I have missing that I should have mentioned earlier.

What if the target structure I am looking for is of this type:

Code:

Pictures
     2001
        2001-03-15 SFO Trip
             IMG-301.jpg
             .
             .
     2002
        2002-01-17 Vegas Trip
             IMG-809.jpg
             .
             .
             
Is it possible to do it one command line given that there are two different ways date format needs to be. Is there a way to specify date format multiple times in the same command line... something like:

Code:

exiftool -r -d %Y "-Directory<DestinationDir/$DateTimeoriginal/$DateTimeoriginal-$Title"  "C:/Documents and Settings/Administrator/My Documents/SourceDir

Or do we have to do multiple passes? Or maybe an arguments file?

Thanks
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by exiftool on 2007-09-23 00:45:13-07]

Just be thankful that you don't want a tag name between the
two date formats.  Because the way you want it works fine with
a command like this:

Code:
exiftool -r -d %Y/%Y-%m-%d "-Directory<tmp/$DateTimeoriginal/$Title"  "C:/Documents and Settings/Administrator/My Documents/Pictures"

- Phil
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by exiftool on 2007-09-23 00:47:23-07]

Ooops.  I got that a bit wrong (left in the '/' after the date.  This
will do better:

Code:
xiftool -r -d %Y/%Y-%m-%d "-Directory<tmp/$DateTimeoriginal $Title"  "C:/Documents and Settings/Administrator/My Documents/Pictures"

- Phil
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by vk1 on 2007-09-23 01:19:16-07]

Phil

This is awesome. Thanks a lot. I think I am all set........hopefully for now :-)

Thanks
vk1
Title: Re: Creating a directory hierarchy using exiftool.exe
Post by: Archive on May 12, 2010, 08:54:08 AM
[Originally posted by exiftool on 2007-09-27 12:35:46-07]

Phil wrote

Code:
> The -o option is being overridden by setting the Directory tag, so it has no effect.

I was just browsing the documentation and realized that I had provided examples
illustrating this behaviour.  See example number 11 on the
Writing
"FileName" and "Directory" tags
page.

- Phil