diff --git a/src/util.cpp b/src/util.cpp index 5d60c47bc64a6bbcb383ec05ca7e245692fb0f29..322d06ad9d5e3e3846f2b45ed219301ed3df1c24 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -48,17 +48,22 @@ void removeEverythingOlderThan(const std::vector &dirs, time_t t) { directory_iterator end_itr; for (directory_iterator itr(p); itr != end_itr; ++itr) { if (last_write_time(itr->path()) < t) { - if (is_regular(itr->path())) { - remove(itr->path()); - } - else if (is_directory(itr->path())) { - std::vector nextDirs; - nextDirs.push_back(itr->path().string()); - removeEverythingOlderThan(nextDirs, t); - if (is_empty(itr->path())) { - remove_all(itr->path()); + try { + if (is_regular(itr->path())) { + remove(itr->path()); + } + else if (is_directory(itr->path())) { + std::vector nextDirs; + nextDirs.push_back(itr->path().string()); + removeEverythingOlderThan(nextDirs, t); + if (is_empty(itr->path())) { + remove_all(itr->path()); + } } } + catch (const filesystem_error& ex) { + + } } }