General
cancel
Showing results for 
Search instead for 
Did you mean: 

Removing log files more than 200000 to 1000000 files

gundawar srinivas
Occasional Contributor

Removing log files more than 200000 to 1000000 files

Dear Experts ,

I have HPUX 11.11 box and i have to remove the directory which contains more than 200000 log files of application . Is there any kernel parameter need to be changed for removing .

Can any one tell me how to remove those log file with in less time period .

I have tried command rm -rf it takes more time .
3 REPLIES
Steven E. Protter
Exalted Contributor

Re: Removing log files more than 200000 to 1000000 files

Shalom,

Third one like this.

ls -1 > filelist


while read -r fn
do
rm -f $fn
done < filelist

Done

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Hemmetter
Esteemed Contributor

Re: Removing log files more than 200000 to 1000000 files

hi,

what about renaming the directory "away", recreate it for new logs and then slowly delete the old?

see also thread http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1268712

rgds
HGH


Adam W.
Valued Contributor

Re: Removing log files more than 200000 to 1000000 files

Try this.

# touch -amt 200504150000 /tmp/ref1
# touch -amt 200802282359 /tmp/ref2

# find "DIR" -xdev -type f -newer /tmp/ref1 -a ! -newer /tmp/ref2 -exec rm {} \+

This will remove files that are newer (more recently modified) than April 15 at 0000 2005 AND NOT newer than Feb, 28th 2359 of this year. This can be modified to do ANYTHING. Touch is an awesome way to remove stuff.
There are two types of people in the world, Marines and those who wish they were.