Page 1 of 1

How to create subfolders

PostPosted: Tue Nov 05, 2019 12:15 pm
by combi06
Hi,

I am looking for a rule that can create subfolders when I add a new folder.

For example:

I have a main folder called 'Installations' where all of my projects reside. Inside each installation folder I then create three separate subfolders (Pictures, Site docs, and Schematics). I want to automate creating the three subfolders (pictures, site docs, schematics) once I create a new project folder.

- Installations (monitored folder)
- Project XYZ - SO123456 (the condition would be any (new) folder that contains SO- in the name)
- Pictures (created automatically)
- Schematics (created automatically)
- Site Docs (created automatically)

The folder hierarchy should look like this:
Image

Is this possible with Hazel?

Thank you in advance!

Re: How to create subfolders

PostPosted: Wed Nov 06, 2019 10:22 am
by Mr_Noodle
Hazel can only create subfolders when putting a file into it. There's no built-in action to just create them. You can use an AppleScript or shellscript to do that. I think there might be on one the forums so it's worth a search.

Re: How to create subfolders

PostPosted: Wed Nov 06, 2019 12:24 pm
by combi06
Understood. I actually found a way to do it via Automator. Having said that, the roadblock I'm running into is that I have a general folder with a few PDFs (installation guides, etc). One of the new folders created with the Automator app is to store the installation guide accordingly depending on the type of install. I would like to copy the installation guide from the general folder to the new respective folder based on a rule related to the name of the folder

eg.

> Installations
> Project XYZ ABCProduct - SO12345 (the rule would be 'if name contains 'ABC' then to copy that file from the general folder to the newly created one below)
> Pictures
> Install Guides and Bulletins
>ABCProduct install guide.pdf (file to be copied from general folder to the newly created Install Guides and Bulletins subfolder)
>Schematics

I'm not sure I can do this with Hazel as I haven't find an option to do this but I'm not really well versed in programming (just a lot of YouTube videos and online research). I'm hoping you or someone more experienced can help me to achieve this (if it is even possible with Hazel)

Thank you!

Re: How to create subfolders

PostPosted: Thu Nov 07, 2019 10:44 am
by Mr_Noodle
If you are going to immediately file stuff into the subfolders, then you don't necessarily need the Automator workflow. Hazel's "Sort into subfolder" action will create the folder as needed. Can you post the rule as you have it so far as I'm not sure exactly where you are running into problems.