From 2706202c17bdfdc28e609ac5325be5701c62b151 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Tue, 16 Jul 2024 15:09:42 +0200 Subject: [PATCH] add all rename --- src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 6f58bab..6c049af 100644 --- a/src/main.c +++ b/src/main.c @@ -23,12 +23,14 @@ void rename_files(const char* dir_path) for (int i = 0; i < files.gl_pathc; i++) { stat(files.gl_pathv[i], &statbuf); rename_lower_str(files.gl_pathv[i], output_filename); - if (strcmp(files.gl_pathv[i], output_filename) != 0) + if (strcmp(files.gl_pathv[i], output_filename) != 0) { printf("%s -> %s\n", files.gl_pathv[i], output_filename); - if (S_ISDIR(statbuf.st_mode)) { - rename_files(files.gl_pathv[i]); + rename(files.gl_pathv[i], output_filename); } + if (S_ISDIR(statbuf.st_mode)) + rename_files(output_filename); + memset(output_filename, 0, STR_MAX_LENGTH); } -- 2.39.5