Download folder on Mac
i need a script or Automator to empty the download folder ( keep the last 30 days )
A procedure or step by step will be appreciate ;)
Thank you very much,
Stewart
iMac Line (2012 and Later)
You can make a difference in the Apple Support Community!
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.
i need a script or Automator to empty the download folder ( keep the last 30 days )
A procedure or step by step will be appreciate ;)
Thank you very much,
Stewart
iMac Line (2012 and Later)
Create in Automator a new Workflow with the following actions:
Get Specified Finder Items
Add the Downloads folder to it
Get Folder Contents
Check "Repeat for each subfolder found"
Filter Finder Items
Set "All" of the following are true
"Date last modified" "is not in the last" "30" "days"
Move Finder Items to Trash
Create in Automator a new Workflow with the following actions:
Get Specified Finder Items
Add the Downloads folder to it
Get Folder Contents
Check "Repeat for each subfolder found"
Filter Finder Items
Set "All" of the following are true
"Date last modified" "is not in the last" "30" "days"
Move Finder Items to Trash
You can Save the Workflow as an Application (say, Cleanup.app) in the Application folder.
To schedule the application to run daily:
Add your app (Cleanup.app) to System Preferences -> Security & Privacy > Privacy > Accessibility
Create a User LaunchAgent in your Library (~/Library/LaunchAgents/). It's an XLM file (plain text).
Let's name it com.maclouds.cleanup.plist containing the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.maclouds.cleanup</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Cleanup.app/Contents/MacOS/Application Stub</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>10</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
</array>
</dict>
</plist>
The value in StartCalendarInterval is set at 10:00 AM. Change the time as you prefer.
In Terminal run the following command to load the just created LaunchAgent:
launchctl load ~/Library/LaunchAgents/com.maclouds.cleanup.plist
If you don't want to play with LaunchAgent and Terminal, there're some apps for scheduling, like Lingon.
Hi Stewart,
this should run every Saturday at 10:00 AM:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.maclouds.cleanup</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Cleanup.app/Contents/MacOS/Application Stub</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>10</integer>
<key>Minute</key>
<integer>00</integer>
<key>Weekday</key>
<integer>6</integer>
</dict>
</array>
</dict>
</plist>
Basically, only Weekday and 6 are added.
6 is Saturday, 7 is Sunday, 1 is Monday, etc.
Thank you very much Marco to take the time to answer me, this resolve my problem with the Download Folder and Empty the trash automatically ;)
The fun thing about that is you made me want to learn more about scripts and automator, thank you !
I don't know where you from but if you come around Montreal (Quebec) in the future, let me know i will invite you to a very good restaurant :)
Stewart
Thank you very much Marco !
Do i have to execute the workflow manually ? is there a schedule ?
And finally, where do i have to save the workflow ?
Thanks again !
Thanks a lot Marco ;)
You're the best !
I am now looking to schedule empty the trash automatically once a week...
Stewart
Hi Stewart,
I'm glad I helped.
I'm from Italy. I'll keep in mind your offer if I'll drop in Montreal. 🙂
Thanks.
Download folder on Mac