Operating System - HP-UX
1752806 Members
5577 Online
108789 Solutions
New Discussion юеВ

Housekeeping of old files on HP-UX

 
SOLVED
Go to solution
RAC_1
Honored Contributor

Re: Housekeeping of old files on HP-UX

You can further reduce the time (after xargs use) by limiting the search to alphabetical splits. Remove files from a-d first and then so on and so forth.

find /dir -name "[aA-dD]*" -exec ll -d {} \; |xargs -t rm 2>>/dir/remove.log
There is no substitute to HARDWORK
James R. Ferguson
Acclaimed Contributor

Re: Housekeeping of old files on HP-UX

Hi:

Removing files in groups (e.g. [A-F], [G-K] etc.) as opposed to in one pass will not gain anything.

By breaking one 'find' into several, you will end up walking the same trees, and 'stat'ing the *same* files multiple times before they are ultimately removed.

The use of 'xargs' in lieu of '-exec' will result in your user's thanking you.

Regards!

...JRF...
dirk dierickx
Honored Contributor

Re: Housekeeping of old files on HP-UX

well, yeah, something like that _can_ take a long time. as long as it gets done, i don't have a problem with it in general.
now, what your problem is seems to be that the process slows down your system. just let it run, but renice it to begin with. it might even take longer to complete, but at least it will not interfere (much) with the rest of your system.

nice
Tor-Arne Nostdal
Trusted Contributor

Re: Housekeeping of old files on HP-UX

So you would:
* Optimize the find by using xargs instead of -exec
and
* Be nicer to the CPU with the "nice" command

A comment to Dirk's "nice" command.

For the command to really be nice to the system you would want to use a positive value!!!

Example:
nice 10 "command"

If you additionally put it to run in background it will be even slightly nicer.

nice 10 "command" &

An unsigned value increases the system nice value causing it to run at lower priority.

A negative value (less nice)=higher priority

Positive value = nicer :-))
because it get lower priority.

/2r
I'm trying to become President of the state I'm in...