Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can you use Automator to tell Finder to move files in a particular folder to a different location after the specific files are a certain age?

Can you use Automator to tell Finder to move files in a particular folder to a different location after the specific files are a certain age? Is this possible?


I have an SSD and an HDD in my system, and I would like the most recent downloads to stay in the downloads folder on my ssd for quick access, but after awhile have the older downloads move to a folder on my HDD.


I've tried using automator but cannot find the necessary scripts to create that kind of workflow. Then was going to set it to a calendar event.


Can anyone help?

iMac, Mac OS X (10.6.8), 2.5 GHz Intel Core i5, 32 GB Ram

Posted on Feb 1, 2014 2:03 PM

Reply
6 replies

Feb 1, 2014 3:06 PM in response to saladino

You can use launchd to run a script daily.

The script would move files that are older than 7 days (based on the access time) from the Downloads Folder to the Desktop (edit as needed):


#!/bin/bash


seven_days_ago=$(date -v -168H +%s)


for f in ~/Downloads/*

do

if [ -e "$f" ] ; then

if [ $(stat -f %Da "$f") -lt $seven_days_ago ]; then

mv "$f" ~/Desktop

fi

fi

done


Put this script in your favorite Folder (I use ~/Library/Scripts)

Now to trigger the script daily, place this launchd plist in ~/Library/LaunchAgents/, and edit for the location of the script, and when you want it to run (I have it at 8:24pm daily). Reboot (or log out and back in) for the launchd to take effect.


<?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>KeepAlive</key>

<false/>

<key>Label</key>

<string>com.tonyt.MoveFiles</string>

<key>ProgramArguments</key>

<array>

<string>/Users/Tony/Library/Scripts/MoveFiles.sh</string>

</array>

<key>StartCalendarInterval</key>

<dict>

<key>Hour</key>

<integer>20</integer>

<key>Minute</key>

<integer>24</integer>

</dict>

</dict>

</plist>


Can you use Automator to tell Finder to move files in a particular folder to a different location after the specific files are a certain age?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.