[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Date scripting



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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]