Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

docs: update documentation of commands delete,purge,rmdir,rmdirs

albertony79474b2e4c48
diff --git a/cmd/delete/delete.go b/cmd/delete/delete.go
index 4f73709fe..c7455ea5f 100644
--- a/cmd/delete/delete.go
+++ b/cmd/delete/delete.go
@@ -21,25 +21,26 @@ func init() {
var commandDefinition = &cobra.Command{
Use: "delete remote:path",
- Short: `Remove the contents of path.`,
+ Short: `Remove the files in path.`,
Long: `
Remove the files in path. Unlike ` + "`" + `purge` + "`" + ` it obeys include/exclude
filters so can be used to selectively delete files.
-` + "`" + `rclone delete` + "`" + ` only deletes objects but leaves the directory structure
+` + "`rclone delete`" + ` only deletes files but leaves the directory structure
alone. If you want to delete a directory and all of its contents use
-` + "`" + `rclone purge` + "`" + `
+the ` + "`purge`" + ` command.
If you supply the --rmdirs flag, it will remove all empty directories along with it.
+You can also use the separate command ` + "`rmdir`" + ` or ` + "`rmdirs`" + ` to
+delete empty directories only.
-Eg delete all files bigger than 100MBytes
-
-Check what would be deleted first (use either)
+For example, to delete all files bigger than 100MBytes, you may first want to check what
+would be deleted (use either):
rclone --min-size 100M lsl remote:path
rclone --dry-run --min-size 100M delete remote:path
-Then delete
+Then proceed with the actual delete:
rclone --min-size 100M delete remote:path
diff --git a/cmd/purge/purge.go b/cmd/purge/purge.go
index 1953ee4eb..137e3bd18 100644
--- a/cmd/purge/purge.go
+++ b/cmd/purge/purge.go
@@ -17,8 +17,9 @@ var commandDefinition = &cobra.Command{
Short: `Remove the path and all of its contents.`,
Long: `
Remove the path and all of its contents. Note that this does not obey
-include/exclude filters - everything will be removed. Use ` + "`" + `delete` + "`" + ` if
-you want to selectively delete files.
+include/exclude filters - everything will be removed. Use the ` + "`delete`" + `
+command if you want to selectively delete files. To delete empty directories only,
+use command ` + "`rmdir`" + ` or ` + "`rmdirs`" + `.
**Important**: Since this can cause data loss, test first with the
` + "`--dry-run` or the `--interactive`/`-i`" + ` flag.
diff --git a/cmd/rmdir/rmdir.go b/cmd/rmdir/rmdir.go
index 1c8d6f4ab..31b958a5b 100644
--- a/cmd/rmdir/rmdir.go
+++ b/cmd/rmdir/rmdir.go
@@ -14,10 +14,15 @@ func init() {
var commandDefinition = &cobra.Command{
Use: "rmdir remote:path",
- Short: `Remove the path if empty.`,
+ Short: `Remove the empty directory at path.`,
Long: `
-Remove the path. Note that you can't remove a path with
-objects in it, use purge for that.`,
+This removes empty directory given by path. Will not remove the path if it
+has any objects in it, not even empty subdirectories. Use
+command ` + "`rmdirs`" + ` (or ` + "`delete`" + ` with option ` + "`--rmdirs`" + `)
+to do that.
+
+To delete a path and any objects in it, use ` + "`purge`" + ` command.
+`,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fdst := cmd.NewFsDir(args)
diff --git a/cmd/rmdirs/rmdirs.go b/cmd/rmdirs/rmdirs.go
index 7b8d2d760..4631dee85 100644
--- a/cmd/rmdirs/rmdirs.go
+++ b/cmd/rmdirs/rmdirs.go
@@ -20,15 +20,21 @@ func init() {
var rmdirsCmd = &cobra.Command{
Use: "rmdirs remote:path",
Short: `Remove empty directories under the path.`,
- Long: `This removes any empty directories (or directories that only contain
-empty directories) under the path that it finds, including the path if
-it has nothing in.
+ Long: `
+This recursively removes any empty directories (including directories
+that only contain empty directories), that it finds under the path.
+The root path itself will also be removed if it is empty, unless
+you supply the ` + "`--leave-root`" + ` flag.
-If you supply the --leave-root flag, it will not remove the root directory.
+Use command ` + "`rmdir`" + ` to delete just the empty directory
+given by path, not recurse.
This is useful for tidying up remotes that rclone has left a lot of
-empty directories in.
+empty directories in. For example the ` + "`delete`" + ` command will
+delete files but leave the directory structure (unless used with
+option ` + "`--rmdirs`" + `).
+To delete a path and any objects in it, use ` + "`purge`" + ` command.
`,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)