Date: Fri, 24 Oct 1997 12:58:10 +1000 (EST) From: netserv@mo.cc.swin.edu.au (Bob Schorer) To: questions@FreeBSD.org Subject: Re: deleted huge directory Message-ID: <199710240258.CAA03111@mo.cc.swin.edu.au>
next in thread | raw e-mail | index | archive | help
The 'ls' command fails because it needs to sort the entries and must therefore read them into memory first. 'find' should work ok, or you can use the following small program (if you want, you could add a call to the unlink function to remove each file within the loop). Bob Schorer #include <stdio.h> #include <sys/types.h> #include <errno.h> #ifdef DIRENT #include <dirent.h> #define direct dirent #else #include <sys/dir.h> #endif main(argc, argv) int argc; char **argv; { DIR *fd; struct direct *cat; if (!(fd=opendir(*(argv+1)))) { printf("Directory not found\n"); exit(0); } while ((cat=(struct direct*)readdir(fd))) printf("%s\n", cat->d_name); closedir(fd); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710240258.CAA03111>