]> gitweb.hhaalo.de Git - mv_none_space.git/commitdiff
add all rename
authorBastian Dehn <hhaalo@arcor.de>
Tue, 16 Jul 2024 13:09:42 +0000 (15:09 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 16 Jul 2024 13:09:42 +0000 (15:09 +0200)
src/main.c

index 6f58bab6ec4d6e406556bc6625c77052ae65896e..6c049af9fb856d286a4f358c531e1dd06c617415 100644 (file)
@@ -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);
        }