Noob: Orientation file sorting

Started by layertone, April 15, 2014, 02:14:33 PM

Previous topic - Next topic

layertone

Is there a way to move files automatically to certain folders based on orientation?
Thanks

StarGeek

For quick and easy, but a bit messy looking

ExifTool "-Directory</Destination/Directory/$Orientation" <FILE/DIR>

That will do a quick separate for you, but the final directories will have names like Horizontal (normal), Rotate 180,  Rotate 90 CW,  and Rotate 270 CW.

To move the files to specific directories would take multiple commands, a user defined tag, or a fancy and complicated substitution string.

Simple Examples:
ExifTool -if "$Orientation eq 'Horizontal (normal)'" "-Directory</Destination/Directory/My_Normal_Pics" <FILE/DIR>
ExifTool -if "$Orientation eq 'Rotate 180'" "-Directory</Destination/Directory/My_Upsidedown_Pics" <FILE/DIR>

Complicated Example :
ExifTool "-Directory</Destination/Directory/${Orientation;$_=($_ eq 'Horizontal (normal)') ? 'My_Normal_Pics' : ($_ eq 'Rotate 180') ? 'My_Upsidedown_Pics' : ($_ eq 'Rotate 90 CW') ? 'My_Right_Turned_Pics' :  ($_ eq 'Rotate 270 CW') ? 'My_Left_Turned_Pics' : 'Other_Orientation'}"  <FILE/DIRECTORY>

Replace /Destination/Directory/ with the base directory where you want things moved to.  Replace My_Normal_Pics, My_Upsidedown_Pics,  My_Right_Turned_Pics, My_Left_Turned_Pics, and Other_Orientation with the subdirectories where they end up at, replace <FILE/DIRECTORY> with the files or directory to process.

The above format is also for a windows machine.  If on Mac/Linux, swap the single and double quotes.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

layertone

been trying this for hours with no luck, am I doing something wrong?  Thanks in advance!

exiftool -if "$Orientation eq 'Horizontal (normal)'" "-Directory<c:\output\Landscape" c:\input
exiftool -if "$Orientation eq 'Rotate 180'" "-Directory<c:\output\Portrait" c:\input

StarGeek

Sorry, my mistake.  One which I make often.  It's the difference between using '<' and '='. 

Use these commands
exiftool -if "$Orientation eq 'Horizontal (normal)'" "-Directory=c:\output\Landscape" c:\input
exiftool -if "$Orientation eq 'Rotate 180'" "-Directory=c:\output\Portrait" c:\input


Though I might suggest using
exiftool -if "$Orientation eq 'Rotate 90 CW' or $Orientation eq 'Rotate 270 CW' "  "-Directory=c:\output\Portrait" c:\input

Rotate 180 means the image is upside down, not that it was shot vertically.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

layertone

Awesome, that worked!! Thanks so much for your help!!