delete old files [message #246645] |
Thu, 21 June 2007 09:36 |
Koolwant
Messages: 49 Registered: June 2007 Location: new jersey
|
Member |
|
|
Hey Masters
I want to delete files older than 7 days
The command
find . mtime +7 -exec rm {} \;
works in linux
can somebody tell me the similar command in unix.
Thanks in advance.
Kool
|
|
|
|
Re: delete old files [message #246668 is a reply to message #246651] |
Thu, 21 June 2007 10:56 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
find . -mtime +7 -exec rm {} \;
i=0
for FILE in `find /my-path/logs -name '*.log' -mtime +7 -print`
do
# echo "Deleting $FILE ..."
rm -f $FILE
((i=i + 1))
done
echo "Deleted $i files"
|
|
|
|