"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
lsd: Add -R flag and fix and update docs for all ls commands
Nick Craig-Wood96a62d55a2fe
diff --git a/cmd/ls/ls.go b/cmd/ls/ls.goindex 8938bc812..662f5afdb 100644--- a/cmd/ls/ls.go+++ b/cmd/ls/ls.go@@ -19,6 +19,15 @@ var commandDefintion = &cobra.Command{Long: `Lists the objects in the source path to standard output in a humanreadable format with size and path. Recurses by default.++Eg++ $ rclone ls swift:bucket+ 60295 bevajer5jef+ 90613 canole+ 94467 diwogej7+ 37600 fubuwic+` + lshelp.Help,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(1, 1, command, args)diff --git a/cmd/ls/lshelp/lshelp.go b/cmd/ls/lshelp/lshelp.goindex cb4c656eb..2343f4c5c 100644--- a/cmd/ls/lshelp/lshelp.go+++ b/cmd/ls/lshelp/lshelp.go@@ -16,9 +16,9 @@ There are several related list commands` + "`lsf`" + ` is designed to be human and machine readable.` + "`lsjson`" + ` is designed to be machine readable.-Note that ` + "`ls`,`lsl`,`lsd`" + ` all recurse by default - use "--max-depth 1" to stop the recursion.+Note that ` + "`ls` and `lsl`" + ` recurse by default - use "--max-depth 1" to stop the recursion.-The other list commands ` + "`lsf`,`lsjson`" + ` do not recurse by default - use "-R" to make them recurse.+The other list commands ` + "`lsd`,`lsf`,`lsjson`" + ` do not recurse by default - use "-R" to make them recurse.Listing a non existent directory will produce an error except forremotes which can't have empty directories (eg s3, swift, gcs, etc -diff --git a/cmd/lsd/lsd.go b/cmd/lsd/lsd.goindex c12b38b15..e1123fe72 100644--- a/cmd/lsd/lsd.go+++ b/cmd/lsd/lsd.go@@ -5,23 +5,51 @@ import ("github.com/ncw/rclone/cmd""github.com/ncw/rclone/cmd/ls/lshelp"+ "github.com/ncw/rclone/fs""github.com/ncw/rclone/fs/operations""github.com/spf13/cobra")+var (+ recurse bool+)+func init() {cmd.Root.AddCommand(commandDefintion)+ commandDefintion.Flags().BoolVarP(&recurse, "recursive", "R", false, "Recurse into the listing.")}var commandDefintion = &cobra.Command{Use: "lsd remote:path",Short: `List all directories/containers/buckets in the path.`,Long: `-Lists the directories in the source path to standard output. Recurses-by default.+Lists the directories in the source path to standard output. Does not+recurse by default. Use the -R flag to recurse.++This command lists the total size of the directory (if known, -1 if+not), the modification time (if known, the current time if not), the+number of objects in the directory (if known, -1 if not) and the name+of the directory, Eg++ $ rclone lsd swift:+ 494000 2018-04-26 08:43:20 10000 10000files+ 65 2018-04-26 08:43:20 1 1File++Or++ $ rclone lsd drive:test+ -1 2016-10-17 17:41:53 -1 1000files+ -1 2017-01-03 14:40:54 -1 2500files+ -1 2017-07-08 14:39:28 -1 4000files++If you just want the directory names use "rclone lsf --dirs-only".+` + lshelp.Help,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(1, 1, command, args)+ if recurse {+ fs.Config.MaxDepth = 0+ }fsrc := cmd.NewFsSrc(args)cmd.Run(false, false, command, func() error {return operations.ListDir(fsrc, os.Stdout)diff --git a/cmd/lsf/lsf.go b/cmd/lsf/lsf.goindex b040d3023..633732168 100644--- a/cmd/lsf/lsf.go+++ b/cmd/lsf/lsf.go@@ -46,6 +46,15 @@ standard output in a form which is easy to parse by scripts. Bydefault this will just be the names of the objects and directories,one per line. The directories will have a / suffix.+Eg++ $ rclone lsf swift:bucket+ bevajer5jef+ canole+ diwogej7+ ferejej3gux/+ fubuwic+Use the --format option to control what gets listed. By default thisis just the path, but you can use these parameters to control theoutput:@@ -58,6 +67,15 @@ output:So if you wanted the path, size and modification time, you would use--format "pst", or maybe --format "tsp" to put the path last.+Eg++ $ rclone lsf --format "tsp" swift:bucket+ 2016-06-25 18:55:41;60295;bevajer5jef+ 2016-06-25 18:55:43;90613;canole+ 2016-06-25 18:55:43;94467;diwogej7+ 2018-04-26 08:50:45;0;ferejej3gux/+ 2016-06-25 18:55:40;37600;fubuwic+If you specify "h" in the format you will get the MD5 hash by default,use the "--hash" flag to change which hash you want. Note that thiscan be returned as an empty string if it isn't available on the object@@ -69,11 +87,30 @@ For example to emulate the md5sum command you can userclone lsf -R --hash MD5 --format hp --separator " " --files-only .+Eg++ $ rclone lsf -R --hash MD5 --format hp --separator " " --files-only swift:bucket+ 7908e352297f0f530b84a756f188baa3 bevajer5jef+ cd65ac234e6fea5925974a51cdd865cc canole+ 03b5341b4f234b9d984d03ad076bae91 diwogej7+ 8fd37c3810dd660778137ac3a66cc06d fubuwic+ 99713e14a4c4ff553acaf1930fad985b gixacuh7ku+(Though "rclone md5sum ." is an easier way of typing this.)By default the separator is ";" this can be changed with the--separator flag. Note that separators aren't escaped in the path soputting it last is a good strategy.++Eg++ $ rclone lsf --separator "," --format "tshp" swift:bucket+ 2016-06-25 18:55:41,60295,7908e352297f0f530b84a756f188baa3,bevajer5jef+ 2016-06-25 18:55:43,90613,cd65ac234e6fea5925974a51cdd865cc,canole+ 2016-06-25 18:55:43,94467,03b5341b4f234b9d984d03ad076bae91,diwogej7+ 2018-04-26 08:52:53,0,,ferejej3gux/+ 2016-06-25 18:55:40,37600,8fd37c3810dd660778137ac3a66cc06d,fubuwic+` + lshelp.Help,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(1, 1, command, args)diff --git a/cmd/lsl/lsl.go b/cmd/lsl/lsl.goindex 83e17d16b..7021b8429 100644--- a/cmd/lsl/lsl.go+++ b/cmd/lsl/lsl.go@@ -19,6 +19,15 @@ var commandDefintion = &cobra.Command{Long: `Lists the objects in the source path to standard output in a humanreadable format with modification time, size and path. Recurses by default.++Eg++ $ rclone lsl swift:bucket+ 60295 2016-06-25 18:55:41.062626927 bevajer5jef+ 90613 2016-06-25 18:55:43.302607074 canole+ 94467 2016-06-25 18:55:43.046609333 diwogej7+ 37600 2016-06-25 18:55:40.814629136 fubuwic+` + lshelp.Help,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(1, 1, command, args)