Tiny Core Base > TCB Q&A Forum

rm -rf not working !

(1/2) > >>

mb0:
An error in a program recursively created new directories until it error'd because the max depth had been reached.. now i have /folder/path/1/1/1/1/1/1/1/1/1/1/1... etc.

cd /folder/path
rm -rf ./1

--- Code: ---...
rm: can't remove './1/1/1/1': Directory not empty
rm: can't remove './1/1/1': Directory not empty
rm: can't remove './1/1': Directory not empty
rm: can't remove './1': Directory not empty

--- End code ---

???

i thought i had solved it by using mv to split up the paths, but seems that it just copied and didn't move it!

spence91:
Interesting.

I guess you could use some cmd-fu to get yourself to the farthest branch and then delete backwards...

something like below (MASSIVE WARNING - UNTESTED IN ANY WAY)


--- Code: ---while [ 1 ] ;
do
 cd ./1 || break ;
done ;

cd ../

while [ 1 ] ;
do
 rm -fr ./1
 ls ./1 || break ;
done

--- End code ---

tinypoodle:
On which filesystem is this?

mb0:
ext3

Rich:
Hi mb0
If I had to guess, I'd say this might be caused because the directory structure is deeper than rm can reach.

@spence91: I think this might work better:

--- Code: ---while [ 1 ] ;
do
 cd ./1 || break ;
done ;

cd ../

while [ 1 ] ;
do
 ls ./1 || break ;
 rm -fr ./1
 cd ../
done
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version