MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / remove_directory

Function remove_directory

nanofi/src/core/file_utils.c:63–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void remove_directory(const char * dir_path) {
64
65 if (!is_directory(dir_path)) {
66 if (unlink(dir_path) == -1) {
67 printf("Could not remove file %s\n", dir_path);
68 }
69 return;
70 }
71
72 uint64_t path_len = strlen(dir_path);
73 struct dirent * dir;
74 DIR * d = opendir(dir_path);
75
76 while ((dir = readdir(d)) != NULL) {
77 char * entry_name = dir->d_name;
78 if (!strcmp(entry_name, ".") || !strcmp(entry_name, "..")) {
79 continue;
80 }
81 char * path = concat_path(dir_path, entry_name);
82 remove_directory(path);
83 free(path);
84 }
85
86 rmdir(dir_path);
87 closedir(d);
88}
89
90int make_dir(const char * path) {
91 if (!path) return -1;

Callers 2

clear_content_repoFunction · 0.85

Calls 2

is_directoryFunction · 0.70
concat_pathFunction · 0.70

Tested by 1