Re: Too many subdirectories
On Mon, 15 Mar 1999, Sami Dalouche wrote:
> I made a c program :
>
> #include <stdio.h>
> main()
> {
> int nbr=0;
> while(1)
> {
> printf("%d\n",nbr+=1);
> mkdir ("x");
> chdir ("x");
> }
> exit(0);
> }
I hate to ask, but... why??? I duplicated this for the sake of making
sure this script would work, and it brought my system to it's knees.
> My problem is that there is now too many subdirectories (10,000) and rm said
> " Memory exhausted " when I type
> rm -rf x
> Does anyone know of a C script which can suppress all these directories ?
> Thanks.
This should do it but it'll take forever
#!/bin/sh
while [ -d 'x' ] ; do
mv x/x x1
rmdir x
mv x1 x
done
just put that in a text file, chmod it to 755 and run it.
Good luck.
-Dano
Reply to: