excess files
Rob Brown-Bayliss
on_the_net@clear.net.nz
18 Oct 2001 21:46:30 +1300
--=-bsZxcCGIWeKs3Q5SULlJ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
> So you could thow them all away. However you may want to keep at least the latest
> just in case the inpossable happens and the working file gets corrupted.
>
I have a small shell script, which is run before I use gnucash which
deletes all files in the directory older than a specific number of
days. It's attached, but it's not my fault if you run it as root and
loose everything :o)
--
Rob Brown-Bayliss
---======o======---
--=-bsZxcCGIWeKs3Q5SULlJ
Content-Type: text/x-sh
Content-Disposition: attachment; filename=deleteold.sh
Content-Transfer-Encoding: 7bit
#!/bin/sh
Daysold=$((30 * 86400))
Current=`date +%s`
for file in *
do
FileDate=`date -r $file +%s`
if [ $FileDate -lt $((Current - Daysold)) ]
then
rm -rf $file
fi
done
--=-bsZxcCGIWeKs3Q5SULlJ--