Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Archiving using find command with -atime

Status
Not open for further replies.

tommcc

MIS
Feb 3, 2002
3
0
0
GB
hi all

this is not a syntax question...

can anyone explain why it is when I use the following find command it does not remove the archive files older than 14 days ? I know it is because the files have been accessed < 14 days ago, but I don't understand how the access time is changing on the files....

find /usr/lpp/log/archive -name &quot;*.log*&quot; -atime +14 -exec \rm {} \;

this command is run daily as a cronjob

There are files older than 14 days (ls -l) in this directory, but when I run ls -ul I find that the last accessed time = date the cron job ran

I know the find command will change the access time of directories supplied as pathnames, but why does this affect the contents of the directory also ?

cheers
 
Hi tommcc
Have you tried cd'ing into the dir first;
cd /usr/lpp/log/archive
find . &quot;*.log*&quot; -atime +14 -exec rm {} \;
HTH
Nogs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top