On 31 Oct 1998, in message <[EMAIL PROTECTED]>
  Sami Dalouche <[EMAIL PROTECTED]> wrote:
| I've made a script :
| 
| while true
| do
| mkdir 1
| cd 1
| done
| 
| and executed in my /tmp directory
| so I've ????? thousands of subdirectories
| 
| When I do 
| rm -rf 1, it say 
| 1/1/1..../1 Directory not empty" for the last directory !

Yeah, you've hit the pathname-too-long-problem.

Just reverse things. Make a script (really, don't put this in the command
line because it uses exit, and will log you out at the end:-)

        # recurse to the bottom
        while [ -d 1 ]
        do  cd 1 || exit
            if [ ! -d 1 ]
            then
                # we've hit bottom, start unwinding
                while true
                do cd ..
                   # the set -x is just to see things happening
                   (set -x; rmdir 1) || exit
                done
        done

This way you're always using short pathnames (just as you did when you make
the directories in the first place).
--
Cameron Simpson, DoD#743        [EMAIL PROTECTED]        http://www.zip.com.au/~cs/

A squealing tire is a happy tire.
        - Bruce MacInnes, Skip Barber Driving School instructor

Reply via email to