1827809 Members
1932 Online
109969 Solutions
New Discussion

find and exec

 
navin
Super Advisor

find and exec

Hi All,
I have been running a find command with exec rm ..for a files owned by particular user.but the files are too many as 150,000 .it really takes much longer for this command to complete.
both diskactivity and sar oout put shows very lil activity.any idea would be appreciated
Learning ...
3 REPLIES 3
Patrick Wallek
Honored Contributor

Re: find and exec

There's not a whole lot you can do.

A way to get a little more efficiency would be to do

# find /dir -type f -user username -exec rm -f {} +

Note the '+'. This will allow the exec to be more efficient by grou[ing files to delete rather than just doing one at a time.

Still, 150,000 files will take a while.
navin
Super Advisor

Re: find and exec

this problem has started recently .no much difference in the counts of the files ..problem started last week.
anyways thanks for the reply and any more idea is welcome
thanks
Learning ...
Mark McDonald_2
Trusted Contributor

Re: find and exec

If you can control where the files are located, have them on a separate filesystem, then simply:
umount
newfs
mount

Takes a matter of minutes at most.