diff --git a/Base/usr/share/man/man1/rmdir.md b/Base/usr/share/man/man1/rmdir.md index fd60ee808a..57bc5667c9 100644 --- a/Base/usr/share/man/man1/rmdir.md +++ b/Base/usr/share/man/man1/rmdir.md @@ -15,6 +15,7 @@ Remove given `directory(ies)`, if they are empty ## Options * `-p`, `--parents`: Remove all directories in each given path +* `-v`, `--verbose`: List each directory as it is removed ## Arguments diff --git a/Userland/Utilities/rmdir.cpp b/Userland/Utilities/rmdir.cpp index e7c124e460..f24aa7f13f 100644 --- a/Userland/Utilities/rmdir.cpp +++ b/Userland/Utilities/rmdir.cpp @@ -16,16 +16,21 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio cpath")); bool remove_parents = false; + bool verbose = false; Vector paths; Core::ArgsParser args_parser; args_parser.add_option(remove_parents, "Remove all directories in each given path", "parents", 'p'); + args_parser.add_option(verbose, "List each directory as it is removed", "verbose", 'v'); args_parser.add_positional_argument(paths, "Directories to remove", "paths"); args_parser.parse(arguments); int status = 0; auto remove_directory = [&](StringView path) { + if (verbose) + outln("rmdir: removing directory '{}'", path); + auto maybe_error = Core::System::rmdir(path); if (maybe_error.is_error()) { warnln("Failed to remove '{}': {}", path, maybe_error.release_error());