summaryrefslogtreecommitdiffstats
path: root/commands/rmdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'commands/rmdir.c')
-rw-r--r--commands/rmdir.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/commands/rmdir.c b/commands/rmdir.c
new file mode 100644
index 0000000000..cad0862d86
--- /dev/null
+++ b/commands/rmdir.c
@@ -0,0 +1,35 @@
+#include <common.h>
+#include <command.h>
+#include <fs.h>
+#include <errno.h>
+
+static int do_rmdir (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ int i = 1;
+
+ if (argc < 2) {
+ u_boot_cmd_usage(cmdtp);
+ return 1;
+ }
+
+ while (i < argc) {
+ if (rmdir(argv[i])) {
+ printf("could not remove %s: %s\n", argv[i], errno_str());
+ return 1;
+ }
+ i++;
+ }
+
+ return 0;
+}
+
+static __maybe_unused char cmd_rmdir_help[] =
+"Usage: rmdir [directories]\n"
+"Remove directories. The directories have to be empty.\n";
+
+U_BOOT_CMD_START(rmdir)
+ .maxargs = CONFIG_MAXARGS,
+ .cmd = do_rmdir,
+ .usage = "remove directorie(s)",
+ U_BOOT_CMD_HELP(cmd_rmdir_help)
+U_BOOT_CMD_END