The original address: https://sspai.com/post/35225
Let’s start with the actual requirements, see what the problem is, and learn to use Hazel based on that.
As computers grow in use, the number of files in them grows like crazy, and over time there will be all kinds of messes: piles of files, old files that are rarely cleaned up, confusion about which files are still useful, inability to find the files you need, and so on.
Today we’ll talk about how to organize our computers, using “download” and “desktop” as examples.
Downloads: Files that are rarely handled and pile up over time…
Desktop: often put temporary files stored in this, convenient drag use, but a long time, is all kinds of messy……
Now that we know what the problem is, let’s start sorting it out.
Clear your head
First is to determine the finishing train of thought, such as how to define whether a file and use, such as how to define what it belongs to the classification, the corresponding operation is usually delete (no longer needed or duplicate files, for example) or archive work (learning materials or materials classified storage), know how to handle a file is very well done, the rest is physical work.
While it’s not particularly troublesome, we often forget or are “too lazy to tidy up.” This is a bit like cleaning our house, where we can buy a robot to clean up when we don’t have time or often forget. Similarly, there is a “robot” on the Mac. It is Hazel.
What’s a Hazel?
Hazel is a tool that automatically monitors and organizes folders. Its website describes a simple word: Automated Organization for Your Mac.
It works a bit like IFTTT, in that you can set an if condition and execute the then action on the monitored folder if the item meets the condition (also known as the mailbox’s incoming filtering rules).
Hazel is not a new tool, but it has a long history. The first version was released in late 2006, and on May 4, Hazel released version 4.0, which added rule synchronization (described at the end of this article), rule search, and a number of other utilities.
What exactly can Hazel do?
Here’s a quick list of things Hazel can do:
- Automatically color files based on when they were created (for example, color the most recent file blue)
- Automatically open a specific file with a specific software (e.g. after downloading BT seeds, automatically open the download with thunderbolt)
- Automatically delete downloaded BT seed files
- According to the type of file, automatically move to the corresponding folder (such as pictures to photos folder, movies to video folder, etc.)
- Automatically delete certain files (such as those with fixed content in the title and created long ago)
- Automatically decompress compressed files
- Automatically cleans the file cache for you
- Automatically help you organize photos, can be classified according to the “year – month” to store the corresponding folder
- Automatically upload the contents of folders to network services such as FTP
- Automatically import Photos into Photos, automatically import music into iTunes
- …
Hazel’s support for code directives like AppleScript, JavaScript, and Automator Workflow makes it scalable to the next level, and what you can do is just imagination.
Here’s a quick guide to getting started with Hazel installation and setup.
The installation of the Hazel
To travel towebsiteDownload the latest version, install it as prompted, and Hazel will appear in your system Settings (you can’t find it in the app).
Hazel is a free 14-day trial after initial installation, with the option to load some simple default rules to help you get started quickly (but not after reading this article).
Hazel will pop up a warning message after the operation: Be sure to check these rules before activating them. Specific methods will be mentioned below.
Hazel interface and base applications
Note: At the end of this article, you can download all the Hazel rules. If you are interested in the Hazel rules, you can download them directly.
The main interface of Hazel consists of three parts, namely Folders page for setting folder rules, Trash page for setting Trash rules and other information page (Info). Today, WE mainly explain folder rules setting page.
Folders contain three parts: Set the monitored folder (1 in the figure), set the specific rules under the folder (2 in the figure), and set the repeated file processing of the folder (3 in the figure). The icon on the right of part of The figure 1 represents “pause rule execution” and “synchronize” respectively. It is recommended to pause execution before debugging when trying new rules.
Taking the “Download” folder as an example, my personal requirements are as follows:
- Most recently downloaded files are color-tagged
- Files that are older than 3 days are no longer new. Remove the color label
- Files that have been stored for more than 3 weeks need to be processed. The files that meet this condition are marked in red to remind them
- Automatically delete used.torrent files
- Store screenshots of your phone in a separate store
The above items are selected by Hazel after combing through your organizing requirements. Back at Hazel, click on the plus sign in the lower left corner to add the “Downloads” folder, and then click on the plus sign to add Rules in the Rules area on the right.
Mark the latest downloaded file
The following figure is the interface for setting rules. The rule name and comment are set in Figure 1. The monitoring condition is set in Figure 2. At this time, the file adding time is set before the last matching time (the new file is not matched after adding, so it must be earlier than the matching time). The action set up in Figure 3 is to label the matched files blue and be matched by other rules.
Mark old files
Files that are more than 3 days old and no longer need my attention, remove the blue label from them:
Mark files to be processed
For the “Download” folder, I need to process the files that have not been processed for more than 3 weeks, either archiving or deleting. When I need to make manual judgment, I use red marks to remind myself:
Delete the.torrent file
Note the green symbol in the figure. That is the Preview effect. It is recommended that you use Preview to check whether the conditions are set correctly when setting the rules. Especially if it’s complicated.
Automatic mobile phone screenshots
In my work, I often need to upload screenshots on my mobile phone to my computer for use (upload them to “Download” using AirDrop). The processing of such pictures is generally moved to the desktop folder for centralized processing after more than a week:
The above describes the sorting ideas and implementation of the “download” folder; To “desktop” of folder arrange, my train of thought is not easy to delete automatically commonly (prevent by mistake delete), unify however in classifying folder centralize processing. Putting documents in Documents, images in Images, etc., are very simple and basic Settings that I won’t go into too much;
Here’s what I did with the source file, which involves the nesting of conditions:
In the figure, nested conditions are used. The specific operation is to add a group of nested conditions by long pressing the plus sign on the right side of the mouse (or by holding down Option and clicking).
Attached is the screenshot after desktop cleaning:
Hazel Intermediate application
In addition to the above basic use, Hazel can be used in a wide range of scenarios, such as automatic decompression and automatic cache cleaning.
Automatically decompressed
After downloading the compressed package, Hazel automatically creates a folder (named after the compressed package) and stores the compressed package and the decompressed file in this folder:
Three points need to be made:
- The label is set to prevent the compressed file from getting corrupted and causing Hazel to fall into a loop;
- You cannot set automatic deletion because Hazel will automatically select the decompressed file and delete only the decompressed file.
- The default ‘Unarchive’ operation can also be used to extract The.zip file, but it will be automatically deleted after The decompression, so I used The Unarchiver free third-party decompression software instead (note: permission Settings are required for The first time). If you don’t mind deleting the compressed package, use the default decompression operation.
Thank you for referencing Brian Koponen’s blog for this rule.
Automatic cache clearing
QQ, for example, automatically saves images from group messages to local folders, which can easily grow to a few gigabytes in size over time, and Hazel can come in handy.
First find your QQ folder, you can try the following path (my Mac system 10.11)
/ Users/username/Library/Containers/com. Tencent qq/Data/Library/Application Support/qqCopy the code
Change the “username” to your own in the path, then press and press “⌘ + Shift + G” in the Finder, paste the path into the input box and click “Go”.
If there is no problem with the path, you can add this folder in Hazel. Click the “Add” button to pop up the folder selection interface, and use the above shortcut keys and path to quickly select the folder. After adding, set the following two rules: The first rule enables all subfolders to adapt to the rule and perform operations; The second rule is to delete a child folder whose size exceeds 500 MB without directly deleting the parent folder.
At this point, automatic cleaning of QQ cache files is set to complete, other software cache can also carry out similar rules design, but must be careful to ensure that there is no file you need, otherwise once deleted to retrieve is also very troublesome.
More usage
As mentioned above, Hazel can do more than just these scenarios. Users can also use Hazel to organize photos, perform more complex workflows using AppleScript, and more.
Other features
Garbage bin Management
In the Hazel Trash page, you can set up some Trash bins, such as deleting files that are more than a week old, keeping the Trash size at around 2GB, selecting whether to use the safe delete function when deleting, and detecting the attached folders when uninstalling applications, etc. This aspect of the function of the author is not commonly used, do not do too much introduction here.
When deleting an application, detect related files and delete them altogether. It works like CleanMyMac.
The synchronization rules
Syncing was finally introduced in 4.0 and can now be easily used on multiple computers. To open the Sync screen, click on the gear icon in the left panel and select Rule Sync Options (or right-click on the folder and select Rule Sync Options).
If the current folder is used for synchronization for the first time, you need to Set the path for storing the synchronization file by clicking Set Up new Sync File. To Use a synchronized file, click Use Existing Sync File on the screen.
Hazel download
Hazel is a premium software (download address), released in early May with version 4.0. It costs $32 to purchase separately, $49 for the Family Pack, and $10 to upgrade from version 3.0. The initial download is free for a 14-day trial, and it is recommended that you try before you buy.
Finally, I offer you my own Hazel Settings that you can import and adjust to suit your own rules:Baidu Cloud Download.