Subfolder Depth

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

Moderator: Mr_Noodle

Subfolder Depth Wed Dec 14, 2016 9:38 am • by jthawke
I successfully created an automator workflow that runs on a folder, but I'm really struggling with the subfolder depth issue.

In my case, I am trying to add a new folder to all of the existing client folders on a server. There are about 4000 subfolders but they are all at the same depth to the root folder, although they are nested (ie, root folder, folders named 1000-2000, then folders named 1000-1099, then folders named 1000.01, 1001.01, etc. All of those folders contain a "." in the name so their unique in that way, but they should all be at the same depth to the root folder. Regardless, I'd like the rule to run on folders regardless of their depth because they would all match the naming convention and I don't have to worry about it running against the wrong folder.

I am trying to create a rule that will start at the root level folder and then for ANY subfolder with a "." in the name, run the automator workflow.

Thank you.
jthawke
 
Posts: 3
Joined: Wed Dec 14, 2016 9:30 am

Re: Subfolder Depth Wed Dec 14, 2016 11:45 am • by Mr_Noodle
Note that if there's a dot, everything afterwards is treated as the extension. Make sure to use "Full name" in this case to match correctly.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Subfolder Depth Wed Dec 14, 2016 6:09 pm • by jthawke
Thank you . . . I am using Full Name.

I just can't quite figure out how to set the root folder of all of the other folders, but get the script to run on the sub folders at each additional level when it comes across a folder with a "." in the name.
jthawke
 
Posts: 3
Joined: Wed Dec 14, 2016 9:30 am

Re: Subfolder Depth Wed Dec 14, 2016 6:33 pm • by jthawke
Well, it apparently just took a little more trying. I got it to work. For those who are looking into this thread, here is the "fix".

I was trying to make sure that any folder with a "." in the Full Name would then run an Automator Workflow that would create a new folder named "Applications". I didn't want to have to manual create or copy/paste this folder 1000s of times and the structure of the drive is such that finding all of those correct folders would make it difficult to know that I "touched" them all.

So I made two rules. One looks for Type = Folder and Full Name contains "." These will always be subfolders located on the drive. The result of the match is run the workflow. But I created a SECOND rule where Type = Folder and Full Name does NOT contain ".", the result of which is to Run Rules on Folder Contents.

Running this set of rules on the root folder finds many folder matches, and then inside those more folder matches, etc. but eventually comes across a folder with a "." in the name. In this case, the first second rule no longer applies, so the workflow rule is triggered and the folder is created.

I hope this helps!
jthawke
 
Posts: 3
Joined: Wed Dec 14, 2016 9:30 am


Return to Support