-
-
Save nhatzHK/da7d2f1978a9d57ed9d460b898b66977 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _XOPEN_SOURCE 500 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ftw.h> | |
static int rmFiles(const char *pathname, const struct stat *sbuf, int type, struct FTW *ftwb) | |
{ | |
if(remove(pathname) < 0) | |
{ | |
perror("ERROR: remove"); | |
return -1; | |
} | |
} | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2) | |
{ | |
fprintf(stderr,"usage: %s path\n",argv[0]); | |
exit(1); | |
} | |
if (nftw(argv[1], rmFiles,10, FTW_DEPTH|FTW_MOUNT|FTW_PHYS) < 0) | |
{ | |
perror("ERROR: ntfw"); | |
exit(1); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment