Q: Use Automator to search through folders and find ones with specified missing subfolder.
I'm trying to figure out how to use automator to look through a block of folders (and subfolders) and then list all folders that do not contain a specifically named folder.
Folders are structured as below:
delivery001/20150504/2157x1536
delivery001/20150505
delivery001/20150506
delivery001/20150507/2157x1536
delivery001/20150508
So I'd like to be able to formulate a way to only find the folders that DO NOT contain the '2157x1536' subfolder and create a list of these results if possible?
I've tried multiple ways, but can only get the list to show folders containing that folder and not vice versa! Any ideas?
MacBook Pro, OS X Mountain Lion (10.8.2), 2.2 Ghz i7 Quad Core/8Gb RAM/750GB
Posted on May 13, 2015 3:17 AM
benjamin-mills wrote:
Thanks so much Tony!
So last but not least.... Say the folders that were missing the 2157x1536 directories contained a bunch of files, would there be a way to move those files into the newly created 2157x1536 folder?
This can be done by adding another Do Shell Script Action with find and -execdir
We also need to use the Set Value of Variable and Get Value of Variable Actions.
Note: This will move all files in the Folders below the selected directory (20150504, 20150505, etc), except .DS_Store to the 2157x1536 Folder:
The new Run Shell Script Action is:
find $1 -type f -depth 2 \! -iname '.DS_Store' -execdir mv "{}" "2157x1536" \;
Posted on May 14, 2015 5:35 AM


