List files not modified for at least 6 days

2007-12-25 3:45:00

Dear Admins,

Do you know a way to list files which have not been modified for at least 6
days ?

Actually, what I need to do is to clean once a week a directory (/gctmp)
with files not modified for at least 6 days.

The following commands would be fine:
$ find /gctmp/. -mtime +6 -exec rm {} \;
$ find /gctmp/. -mtime +6 -exec rmdir {} \;
except that I don't want directory /gctmp/locks to be treated.

I started writing the following scripts:
ls /gctmp | egrep -v "^locks$" | while read file
do
if [[ -d $file ]]
then
find /gctmp/$file -mtime +6 -exec rm {} \;
find /gctmp/$file -mtime +6 -exec rmdir {} \;
else
# What for files under /gctmp not modified for at least 6 days ?
fi
done

But I don't know how to remove files not modified for at least 6 days ?
Any help will be welcome.

Regards,
Sabrina

Comments

Got something to say?

You must be logged in to post a comment.