summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2025-02-22 22:46:47 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2025-02-22 22:46:47 +0100
commit7c8463b343d76949775480faa2b343264f805e84 (patch)
tree2972fd495895155f590a5969ab8bcb982f20c434 /main.c
parentc97a0699cffb4070d2e49cdab7bda6a185140b71 (diff)
working on the recursive deletion of a folder
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/main.c b/main.c
index 63b1e3d..da3d895 100644
--- a/main.c
+++ b/main.c
@@ -149,9 +149,17 @@ void remove_dir(const char *path)
struct dirent *entry;
DIR *dP = opendir(path);
- if (dP == NULL){
- perror("failed to open the directory to delete the files recursivly");
+ if (dP == NULL) {
+ perror("failed to open the directory to delete the files recursively");
}
+
+ // ReSharper disable once CppPointerConversionDropsQualifiers
+ while ((entry = readdir(dP)) != NULL) {
+ if (rmdir(entry->d_name) != 0) {
+ perror("failed to delete the directory 02");
+ }
+ }
+ printf("%p", dP);
}
}