#! /bin/bash ## # This script will remove all files/folders older than 2 weeks in the ~/Downloads # folder. ## rm /Users/ramsi/Downloads/*.torrent find $HOME/Downloads -atime +28 -depth 1 -print | while read FILE; do # Adds support for files with spaces. cmd="mv \"$FILE\" $HOME/.Trash"; # Parses the line twice to remove the external quotes. eval $cmd; echo "`date \"+%Y-%m-%d\"` removed $FILE" >> /var/log/rmold.log; done; return 0;