I have long been a fan of BBEdit's backup option, but have loathed cleaning up after it. If you've used it, you know that it doesn't take long for literally thousands of files to accumulate. Fortunately OS X makes this a breeze with the aid cron and a shell script.
I use the following to perform a daily cleanup:
[Editor: Remember that the script must be made executable (chmod 755 name_of_script) to run, and getting it working via 'cron' is left as an exercise for the reader -- there are tips posted elsewhere here on configuring cron. -rob.]
I use the following to perform a daily cleanup:
#!/bin/shBasically, this script goes into your backup folder, makes a new (sub)folder, and moves all of the backup files for that day into it. The FTP line moves all of the files in the FTP Temp folder into the newly created folder. Finally, the script removes any subfolder over 20 days old. (Alter to your own preference). Note that you must change the "/path/to" lines to match your setup.
cd /path/to/bbedit_backups
mydate=`date +%Y%m%d`
mkdir $mydate
find . -name "200*" -type d -prune -o -type f -exec mv {} $mydate \;
find /path/to/BBEdit/BBEdit\ Support/FTP\ Temp -type f -exec mv {} $mydate \;
find . -type d -ctime +20 -exec rm -rf {} \;
[Editor: Remember that the script must be made executable (chmod 755 name_of_script) to run, and getting it working via 'cron' is left as an exercise for the reader -- there are tips posted elsewhere here on configuring cron. -rob.]
•
[5,681 views]

