Running ImageOptim-CLI on subfolders

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Running ImageOptim-CLI on subfolders Thu Dec 26, 2013 4:44 am • by cahuk
Could please someone help me with the following workflow:

I have my photos in a Photos folder. That folder has a subfolder with the year the photo was taken (e.g 2013). That subfolder has subfolders with the name of the events where the photos were taken. Those subfolders also contain my jpegs.

Since I use JPEGmini, I optimize all jpegs with it. Before I convert my photos from RAW to jpeg, I create a subfolder with the even's name. Then I save the converted photos (jpegs) into that subfolder.

I want the following: after the jpegs are put into the event subfolder I want to run ImageOptim-CLI which invokes JPEGmini. The syntax for ImageOptim-CLI is: imageOptim-CLI -j -d folder. How can I tell imageOptim that it executes itself on the current event subfolder? I think -d $PWD is not enough.

Thanks.
cahuk
 
Posts: 3
Joined: Fri Feb 15, 2013 6:12 pm

Re: Running ImageOptim-CLI on subfolders Thu Dec 26, 2013 1:38 pm • by Mr_Noodle
You probably want to use 'dirname' to get the containing folder. Check the man page for it.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Running ImageOptim-CLI on subfolders Fri Dec 27, 2013 5:26 am • by cahuk
Thanks.

One thing: can I use nested conditions on subfolders (kind is folder and then (nested condition) if subfolder contains jpeg then run the script).
cahuk
 
Posts: 3
Joined: Fri Feb 15, 2013 6:12 pm


Return to Support