/* Destruction de fichiers */ #include #include #include #include #include "tool.h" #include "../common/commun.h" /* Efface un fichier ou une serie de fichier Retourne le nombre de fichier efface ou -1 si erreur */ export int file_unlink ( const char *fpath) /* path de fichier avec ou sans wildcard */ { char *tbstr[400]; int nbentr = dir_getlistp (fpath,0,tbstr,400); int ret = nbentr; int i; for (i=0; i %d\n",path,file_unlink(path)); } void main (void) { printf ("mkdir /tmp/toto -> %d\n",file_mkdir ("/tmp/toto")); printf ("mkdir /tmp/toto1 -> %d\n",file_mkdir ("/tmp/toto1")); printf ("rmdir /tmp/toto1 -> %d\n",file_rmdir ("/tmp/toto1")); printf ("mkdir /tmp/x/y/z -> %d\n",file_mkdiranc ("/tmp/x/y/z")); system ("sh"); file_rmdir ("/tmp/x/y/z"); file_rmdir ("/tmp/x/y"); file_rmdir ("/tmp/x"); file_rmdir ("/tmp/toto"); #if 0 test ("*.bak"); test ("/usr/prj1/tool/*.obt"); #endif } #endif