File Removal Cron Script
From brokenpoet.org wiki
Let's say a user has a poorly coded something that writes a bunch of files and doesn't clear them up. The obvious solution would be for them to fix their code, right?
However this isn't always what we can do.
This is a script meant to be run as a cron job which will remove those files
You will need to modify the path variable.
wget http://scripts.brokenpoet.org/fileremovalcron.sh
#!/bin/bash # written by benjamin cathey 2008.06.20 # to remove files via cron job start=$(date) path="/path/to/files/" files=$(find $path -type f) count=0 email="bcathey@liquidweb.com" for i in $files do count=$(($count + 1)) rm -rf $i done end=$(date) echo "Removed $count files from $path. Started on $start and finished on $end" |mail -s "File removal for $path on `hostname`" $email
