Tip: Create an empty folder structure with Automator

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Mr_Noodle wrote:I think the point here is that sometimes people want to create the folders without having a file to put into them. They want to create all of them up front for future use.

Yes this tip was about populating a folder with empty subfolders. I just renamed the original post title and intro text to be more clear about that aspect.
gcoghill
 
Posts: 277
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

I think you could do it my way by using a dummy file to populate each newly created folder, and just another rule to delete the dummy files.
Trickyt57
 
Posts: 22
Joined: Tue Sep 18, 2018 12:17 am

Mr_Noodle wrote:I think the point here is that sometimes people want to create the folders without having a file to put into them. They want to create all of them up front for future use.



For posterity's sake, here's a way to do it within Hazel:

Use "Run shell script" action. Create an embedded script that uses the mkdir command:

mkdir $1/subfolder1
mkdir $1/subfolder2
mkdir $1/subfolder3
mkdir $1/subfolder4
...

mkdir creates a new empty folder (make directory)
$1 is the variable for the folder being evaluated
"subfolder1" can be replaced with whatever name you want the new subfolder to be
Repeat for as many new subfolders as you need.
hal
 
Posts: 1
Joined: Wed Jan 06, 2021 4:39 pm

Awesome, this is even more ideal.

I had zero shell scripting experience when I created this initially, and even now just barely starting to learn, but yeah this makes way more sense.
gcoghill
 
Posts: 277
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Previous

Return to Tips & Tricks - DO NOT POST QUESTIONS