Create folder if folder doesn't exist

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

Moderator: Mr_Noodle

Create folder if folder doesn't exist Fri Jul 31, 2015 2:48 pm • by toothpaste
It thought this was easy with Hazel but can not get it to work. It runs one time and that is it.

Goal:
Create new folder "output files" in "Downloads" when there is none.

Script:
If
Kind is Folder
Full Name is not "output files"

Do the following
Run Applescript
Code: Select all
tell application "Finder"
   set folderpath to "Harde schijf:Gebruikers:toothpaste:Downloads"
   make new folder at folderpath with properties {name:"output files"}
end tell
toothpaste
 
Posts: 12
Joined: Fri Jul 31, 2015 2:34 pm

Re: Create folder if folder doesn't exist Fri Jul 31, 2015 3:23 pm • by Mr_Noodle
Are you going to put something in it via a Hazel rule? If so, why not just have it created automatically when you file it (Sort into Subfolder creates it for you)?

This doesn't quite work because you are having it trying to match the folder being monitored itself. You'd have to monitor one level up and have the rule match the Downloads folder. You should do the above first though as that's far easier and clearer.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Create folder if folder doesn't exist Fri Jul 31, 2015 4:15 pm • by toothpaste
THX! That did the trick.
toothpaste
 
Posts: 12
Joined: Fri Jul 31, 2015 2:34 pm


Return to Support