Date scripting

Tom Spec samag70-ignore at yahoo.ca
Thu Mar 23 19:47:45 UTC 2006


I do something like this:

#########################
#!/bin/bash
DAYSTOKEEP=30
COMMAND="rm -f"
BASEDIR=/directory/path/
FIND="/usr/bin/find"
$FIND $BASEDIR -mtime +$DAYSTOKEEP -exec $COMMAND {}
\;
##########################

This will find all files with a modification time of
more than 30 days ago and perform a "rm -f" on them. 
It will recurse further down the tree.  If you want it
also to remove directories make it "rm -rf".

Tom





More information about the fedora-list mailing list