[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Too many subdirectories



In foo.debian-user, you wrote:
> 
> --zYM0uCDKw75PZbzx
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: quoted-printable
> 
> I made a c program :
> 
> #include <stdio.h>
> main()
> {
> int nbr=3D0;
> while(1)
> 	{
> 	printf("%d\n",nbr+=3D1);
> 	mkdir ("x");
> 	chdir ("x");
> 	}
> exit(0);
> }
> 
> My problem is that there is now too many subdirectories (10,000) and rm said
> " Memory exhausted " when I type=20
> rm -rf x
> Does anyone know of a C script which can suppress all these directories ?
> Thanks.

#include <stdio.h>
main()
{
  while(1) {
    if(chdir("x") {
      printf("Found the end of these confounded directories.\n");
      while(1) {
        chdir("..");
	if(rmdir("x")) {
	  printf("Back where we started.\n");
	  printf("I'll never do _that_ again!\n");
	  exit(0);
	}
      }
    }
  }
  exit(0);
}


Reply to: