Parallel directory structure for output

Started by Terminus, September 21, 2013, 07:54:14 PM

Previous topic - Next topic

Terminus

I just started using exiftool today, so far I'm really impressed but I'm still figuring things out...

I want to take a bunch of photos with metadata from Microsoft Windows Live Photo Gallery and import into iPhoto.
I've got the metadata converting properly, but I'd like the output to have the same recursive directory structure as the original.

exiftool "-iptc:Caption-Abstract<exif:XPComment" "-iptc:Keywords<exif:XPKeywords" -o /outputdir/ -r /sourcedir/

This works but the output directory is flat, subdirectories aren't created inside it. 

Is there a way to make the directory structure of the output match the original?

Thanks!

Phil Harvey

Here is one way to do what you want:

cd /sourcedir
exiftool "-iptc:Caption-Abstract<exif:XPComment" "-iptc:Keywords<exif:XPKeywords" -o /outputdir/%d -r .


Alternatively, you could use one of exiftool's slightly more advanced features and do it like this:

exiftool "-iptc:Caption-Abstract<exif:XPComment" "-iptc:Keywords<exif:XPKeywords" -o /outputdir/%:2d -r /sourcedir

From the application documentation:

            For %d, the field width/position specifiers may be applied to the
            directory levels instead of substring position by using a colon
            instead of a decimal point in the format specifier.  For example:

                Source Dir     Format   Result       Notes
                ------------   ------   ----------   ------------------
                pics/2012/02   %2:d     pics/2012/   take top 2 levels
                pics/2012/02   %-:1d    pics/2012/   up one directory level
                pics/2012/02   %:1d     2012/02/     ignore top level
                pics/2012/02   %1:1d    2012/        take 1 level after top
                /Users/phil    %:2d     phil/        ignore top 2 levels

            (Note that the root directory counts as one level when an absolute
            path is used as in the last example above.)


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