diff -ru ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp --- ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp 2011-06-28 23:24:09.000000000 +0400 +++ ./boost_1_47_0/libs/filesystem/v3/src/operations.cpp 2012-08-08 12:13:58.000000000 +0400 @@ -389,13 +389,24 @@ if (type == fs::directory_file) // but not a directory symlink { - for (fs::directory_iterator itr(p); + if (ec != 0) { + for (fs::directory_iterator itr(p, *ec); itr != end_dir_itr; ++itr) - { - fs::file_type tmp_type = query_file_type(itr->path(), ec); - if (ec != 0 && *ec) - return count; - count += remove_all_aux(itr->path(), tmp_type, ec); + { + if (*ec) + return count; + fs::file_type tmp_type = query_file_type(itr->path(), ec); + if (*ec) + return count; + count += remove_all_aux(itr->path(), tmp_type, ec); + } + } else { + for (fs::directory_iterator itr(p); + itr != end_dir_itr; ++itr) + { + fs::file_type tmp_type = query_file_type(itr->path(), ec);; + count += remove_all_aux(itr->path(), tmp_type, ec); + } } } remove_file_or_directory(p, type, ec);