Streamline File Management: Enable Auto-Delete Feature for Downloads on Mac Computers

Streamline File Management: Enable Auto-Delete Feature for Downloads on Mac Computers

Mark Lv13

Streamline File Management: Enable Auto-Delete Feature for Downloads on Mac Computers

Key Takeaways

  • Use Automator to create a Folder Action that automatically deletes old files in your Downloads folder.
  • Customize when your files are deleted based on their age, such as those more than a week or month old.
  • The action runs automatically whenever you download new files. It keeps the Downloads folder free from clutter without you needing to do anything.

If you download a lot of files on your Mac, you’ll need to delete the ones you no longer need regularly to avoid congesting your Downloads folder. Doing this manually can be a tedious task. Thankfully, there’s a way to automate it. Let’s show you how.

How to Create a Folder Action in Automator to Delete Downloads Automatically

Apple ships the Automator app with macOS on all its Macs. With Automator, you can automate repetitive tasks on your Mac , so you don’t have to perform them manually.

Automator supports multiple types of tasks. However, what we need for this guide is the Folder Action automation, which triggers an action every time there’s a change to a specified folder. In our case, the Folder Action will automatically delete from the Downloads folder all files and folders that are more than seven days old whenever new ones get added.

KoolReport Pro is an advanced solution for creating data reports and dashboards in PHP. Equipped with all extended packages , KoolReport Pro is able to connect to various datasources, perform advanced data analysis, construct stunning charts and graphs and export your beautiful work to PDF, Excel, JPG or other formats. Plus, it includes powerful built-in reports such as pivot report and drill-down report which will save your time in building ones.

It will help you to write dynamic data reports easily, to construct intuitive dashboards or to build a whole business intelligence cockpit.

KoolReport Pro package goes with Full Source Code, Royal Free, ONE (1) Year Priority Support, ONE (1) Year Free Upgrade and 30-Days Money Back Guarantee.

Developer License allows Single Developer to create Unlimited Reports, deploy on Unlimited Servers and able deliver the work to Unlimited Clients.

Set Up a Folder Action

To create the Folder Action, start by launching the Automator app on your Mac. When it asks you to choose a document type, click on “Folder Action” and hit “Choose.”

Choosing document type in Automator app on a Mac.

Look for a dropdown box in the rightmost pane at the top of the screen. It’ll appear next to the text “Folder Action receives files and folders added to.” Click on it and select “Other.” Then, select the “Downloads” folder in the Finder and hit “Choose.”

Choosing a folder to perform action on in Automator app.

Find the Files to Delete

There are two ways to find your files and folders in the Downloads folder. The first method uses the “Filter Finder Items” action, whereas the second takes advantage of the “Run Shell Script” action. We’ll be using the latter, as the former doesn’t work as expected and fails to return the right files and folders.

Click the search box in the middle pane and look for “Run Shell Script.” Drag this action to the right-hand pane to add it to the workflow.

Adding the Run Shell Script action to the workflow in Automator.

On this action, click the dropdown button next to “Shell” and select the “/bin/bash” option.

Setting the default shell to bash in Automator.

In the text box below that, enter the following command:

find “[path to Downloads directory]/Downloads” -ctime +7d -o -mtime +7d -iname ‘.

The command looks for files created (“-ctime”) or modified (“-mtime”) more than seven days ago (“+7d”). You can change it to whatever time frame you like. For example, changing the “-ctime” figure to “+30d” would only delete files downloaded more than a month ago.

You also need to replace [path to Downloads directory] with the path to the Downloads folder on your Mac. To find the path, open Finder, right-click on “Downloads” in the left sidebar, and select “Get Info.”

On the Downloads Info window that opens, expand the “General” section by clicking the arrow button before it.

Expanding the General tab to view the path of Downloads folder.

Nero Burning ROM:
The ultimate burning program for all your needs!

Right-click on the address next to “Where,” and select “Copy as Pathname.”

Copying the path of Downloads folder on Mac.

Finally, paste it into the command in Automator. Remember to ensure that /Downloads is on the end of the path. Now, click the “Run” button in the Automator window to run the workflow.

Running the Folder Action workflow to verify if the Run Shell Script action returns right files and folders.

If you did everything correctly, it’ll return all the files and folders in the Downloads folder that meet your criteria. You can look at the results by clicking the “Results” tab on the Run Shell Script action.

Run Shell Scription action results.

Auto-Delete the Files

If you’re happy that it’s working, proceed to add the final action to the workflow. Search for “Move Finder Items to Trash” or “Move Finder Items to Bin” in the search box on the middle pane and drag it to the workflow area below the Run Shell Script action such that the two are linked.

Finally, click on File > Save or press Command+S. Then, name the Folder Action and click “Save.” macOS saves all your Automator Folder Actions under the “~/Library/Workflows/Applications/Folder Actions/“ path.

Saving a Folder Action workflow in Automator.

Now, any time you add new files to your Downloads folder, the existing files that are more than a week old will be automatically moved to the trash.

Keep Your Trash Decluttered as Well

As the above Folder Action workflow moves files and folders from your Mac’s Downloads folder into the Trash, your Trash will likely end up with a lot of unused files and folders, and will still eat up your Mac’s storage space. However, you can avoid this by automatically emptying your Trash every 30 days.

  • Title: Streamline File Management: Enable Auto-Delete Feature for Downloads on Mac Computers
  • Author: Mark
  • Created at : 2024-08-31 06:10:21
  • Updated at : 2024-09-01 06:10:21
  • Link: https://some-guidance.techidaily.com/streamline-file-management-enable-auto-delete-feature-for-downloads-on-mac-computers/
  • License: This work is licensed under CC BY-NC-SA 4.0.