Hazel by Noodlesoft watches folders on your Mac and automatically organizes them using rules you define. It can sort files, set properties, add labels and even run Apple Scripts.

Below are som useful Hazel rules.

Lock files to prevent deletion

Create the two rules:

  • Apply rules to subfolders
  • Lock files to prevent deletion

Apply rules to subfolders

This rule tells Hazel to look inside subfolders instead of just the files in the folder you specified. This rule can be omitted if you don’t want Hazel to perform the action on subfolders.

Configure the rule as seen on the screenshot below.

Lock files to prevent deletion

This rule runs an Apple Script on all the files in a folder, which locks the files.

Configure the rule as seen on the screenshot below.

Click the i to edit the script and paste the following.

tell application "Finder"
    set locked of theFile to true
end tell

To test the syntax click the hammer in the bottom left corner, and the code should be properly color coded.

Hide extension for documents

Create the two rules:

  • Apply rules to subfolders
  • Hide document file extension

Apply rules to subfolders

This rule tells Hazel to look inside subfolders instead of just the files in the folder you specified. This rule can be omitted if you don’t want Hazel to perform the action on subfolders.

Configure the rule as seen on the screenshot below.

Hide document file extension

This rules runs an Apple Script on all the files in a folder, which hides the file extension.

Configure the rule as seen on the screenshot below.

Click the i to edit the script and paste the following.

tell application "Finder"
    set extension hidden of theFile to true
end tell

To test the syntax click the hammer in the bottom left corner, and the code should be properly color coded.