aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2012-08-20 03:34:01 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-08-20 03:34:01 +0200
commit345267048defae61a8cb253e4b9061687d841141 (patch)
tree8cc5b40208b9a8909ad7c5f2980a17293166a6c5
parentMake functional. (diff)
downloadmusic-file-organizer-345267048defae61a8cb253e4b9061687d841141.tar.xz
music-file-organizer-345267048defae61a8cb253e4b9061687d841141.zip
Remove all directories.
-rw-r--r--organizemusic.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/organizemusic.cpp b/organizemusic.cpp
index fa862ee..bd4a433 100644
--- a/organizemusic.cpp
+++ b/organizemusic.cpp
@@ -145,12 +145,6 @@ void rename_path(const string &source, const string &stem, ino_t inode)
perror(destination.c_str());
cerr << RESET;
}
- pos = source.find_last_of('/');
- if (pos != string::npos) {
- string dirname = source.substr(0, pos);
- if (!rmdir(dirname.c_str()))
- cout << BLUE << "rmdir" << RESET << ": " << dirname << endl;
- }
}
void make_parents(const string &filepath)
{
@@ -192,6 +186,8 @@ void process_directory(const char *directory)
process_path(joined);
}
closedir(dir);
+ if (!rmdir(directory))
+ cout << BLUE << "rmdir" << RESET << ": " << directory << endl;
}
void process_path(const char *path)
{