Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reverse rmdir in c [closed]
- rm -rf <path-to-directory>/*
- #define _XOPEN_SOURCE 500
- #include <stdio.h>
- #include <ftw.h>
- #include <unistd.h>
- int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
- {
- int rv = remove(fpath);
- if (rv)
- perror(fpath);
- return rv;
- }
- int rmrf(char *path)
- {
- return nftw(path, unlink_cb, 64, FTW_DEPTH | FTW_PHYS);
- }
- system ("rm -rf <path-to-directory>");
Add Comment
Please, Sign In to add comment