Operating System - HP-UX
1833747 Members
2484 Online
110063 Solutions
New Discussion

Delete Huge Directory Tree

 
SOLVED
Go to solution
someone_4
Honored Contributor

Delete Huge Directory Tree

Hello all,

I have to clean up some old application directory trees.

Some of theese dirs have up to 100,000 - 0 byte files.

I am using:
find . -xdev -type f -name "data.*"| xargs rm

And this deletes about 8 files a second.

Just wondering if there would be a faster way of doing this.


Thanks,
Richard
4 REPLIES 4
IT_2007
Honored Contributor

Re: Delete Huge Directory Tree

If they are directories use "-type d " to cleanup faster.
Sandman!
Honored Contributor
Solution

Re: Delete Huge Directory Tree

You can narrow your find/search to the specific directory tree(s) by supplying the "-path" option:

# find . -xdev -path "./myapp/*" -type f -name "data.*" | xargs rm
Ivan Ferreira
Honored Contributor

Re: Delete Huge Directory Tree

I think that you are using the right command, if this deletion process will be common or regular, you may consider the use of a special file system for the files and destroy/recreate the file system when you need to do a cleanup.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
someone_4
Honored Contributor

Re: Delete Huge Directory Tree

that worked thanks