View Single Post

   
  #4 (permalink)  
Old 01-16-2008, 05:32 PM
Icarus Sparry
 
Posts: n/a
Default Re: How to efficiently remove large directory tree

On Tue, 06 Jan 2004 01:27:03 +0000, Darren Dunham wrote:

> In comp.unix.solaris GertK <gert.koopmanREMO@vethisplanet.nl> wrote:
>> Hi,

>
>> A oracle process has tried to dump a core but created recursively a very
>> deeply nested directory structure like this instead:
>> core_8286/core_8286/core_8286/core_8286/....etc etc. until the inodes
>> ran out.

>


> Good luck..


You could also try a shell solution. (echo -n '.' might need to be changed
to echo -e '.\c', depending on your flavour of shell).

I presume that you are certain that it is an almost infinite tree, and not
a corrupted tree. Use 'ls -ia' to make sure that '.', '..' and 'core_8286'
all have different inode numbers (the number before the filename).

#!/bin/sh
while cd core_8286
do
echo -n '.'
done
echo
echo 'Starting to remove'
cd ..
while rmdir core_8286
do
echo -n 'X'
cd ..
done
Reply With Quote