New to AIX: Removing one month old files

New to AIX: Removing one month old files

Post by Jamshaid Ran » Wed, 24 Apr 2002 04:02:37



Is any body can help me to write a script to remove one month old files
from a directory?

Thanks in advance.

Jamshaid

 
 
 

New to AIX: Removing one month old files

Post by Jan-Frode Myklebus » Wed, 24 Apr 2002 05:29:12



> Is any body can help me to write a script to remove one month old files
> from a directory?

Depending on how you define a 'one month old file', you can use
'find' with the '-mtime', '-ctime' or '-atime':

% find /directory -type f -mtime 31 -print

and if this does what you want, you can pipe it to 'xargs rm':

% find /directory -type f -mtime 31 -print | xargs rm

or delete each file directly with:

% find /directory -type f -mtime 31 -exec rm '{}' \;

Read the man-page for 'find'.

  -jf

 
 
 

New to AIX: Removing one month old files

Post by CB219 » Wed, 24 Apr 2002 05:32:59


Do a man on find and look for the -atime function. Should give you a quick
method for accomplishing this.


script to remove one month old files

Quote:> from a directory?

> Thanks in advance.

> Jamshaid

 
 
 

New to AIX: Removing one month old files

Post by Norman Levi » Fri, 26 Apr 2002 09:16:23



>> Is any body can help me to write a script to remove one month old files
>> from a directory?

>> Thanks in advance.

>> Jamshaid

check out 'usr/sbin/skulker' - supplied by IBM - modified by you.
norm

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002

 
 
 

New to AIX: Removing one month old files

Post by Wil Farqwar » Fri, 03 May 2002 08:17:01


I use
" find . -mtime +3  -exec rm -f {} \; " in cron for 3 or 4 days old
files.  
You will want to verfy the # by trying it on old files.




>>> Is any body can help me to write a script to remove one month old
>>> files from a directory?

>>> Thanks in advance.

>>> Jamshaid
> check out 'usr/sbin/skulker' - supplied by IBM - modified by you. norm

> ---
> Outgoing mail is certified Virus Free. Checked by AVG anti-virus system
> (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 -
> Release Date: 4/19/2002