1753325 Members
4700 Online
108792 Solutions
New Discussion юеВ

script help required

 
SOLVED
Go to solution
Nick D'Angelo
Super Advisor

script help required

I would like to remove files >older than 180 days.

For some reason, my syntax does not actually delete them

The filenames are in the following format

trans.20050601

cd /req_dir
find trans* -atime +180 -exec rm{} \;

Any suggestions?
Always learning
4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: script help required

Use mtime instead:

cd /req_dir
find trans* -mtime +180 -exec rm{} \;


Pete

Pete
James R. Ferguson
Acclaimed Contributor

Re: script help required

Hi Nick:

Your problem is that you need a space after the exec'd command and the curly braces.

# find trans* -atime +180 -exec rm {} \;

Regards!

...JRF...
Zigor Buruaga
Esteemed Contributor

Re: script help required

Hi,

Sincerely I'm not sure on this, but I think you should put a blank space between "rm" and the brackets ( rm {} ... ).

Regards,
Zigor
Nick D'Angelo
Super Advisor

Re: script help required

Team Effort , James and Peter,

It was both the space and also the -mtime versus the -atime.

Thanks.

Nickd
Always learning