Added checking for empty (and thus useless) folders.