mirror of
https://github.com/rclone/rclone.git
synced 2026-01-04 17:43:50 +00:00
lsjson: Add --hash-type parameter and use it in lsf to speed up hashing
Before this change if you specified --hash MD5 in rclone lsf it would calculate all the hashes and just return the MD5 hash which was very slow on the local backend. Likewise specifying --hash on rclone lsjson was equally slow. This change introduces the --hash-type flag (and corresponding internal parameter) so that the hashes required can be selected in lsjson. This is used internally in lsf when the --hash parameter is selected to speed up the hashing by only hashing with the one hash specified. Fixes #4181
This commit is contained in:
@@ -29,6 +29,7 @@ func init() {
|
||||
flags.BoolVarP(cmdFlags, &opt.ShowOrigIDs, "original", "", false, "Show the ID of the underlying Object.")
|
||||
flags.BoolVarP(cmdFlags, &opt.FilesOnly, "files-only", "", false, "Show only files in the listing.")
|
||||
flags.BoolVarP(cmdFlags, &opt.DirsOnly, "dirs-only", "", false, "Show only directories in the listing.")
|
||||
flags.StringArrayVarP(cmdFlags, &opt.HashTypes, "hash-type", "", nil, "Show only this hash type (may be repeated).")
|
||||
}
|
||||
|
||||
var commandDefinition = &cobra.Command{
|
||||
@@ -58,17 +59,25 @@ The output is an array of Items, where each Item looks like this
|
||||
"Tier" : "hot",
|
||||
}
|
||||
|
||||
If --hash is not specified the Hashes property won't be emitted.
|
||||
If --hash is not specified the Hashes property won't be emitted. The
|
||||
types of hash can be specified with the --hash-type parameter (which
|
||||
may be repeated). If --hash-type is set then it implies --hash.
|
||||
|
||||
If --no-modtime is specified then ModTime will be blank. This can speed things up on remotes where reading the ModTime takes an extra request (eg s3, swift).
|
||||
If --no-modtime is specified then ModTime will be blank. This can
|
||||
speed things up on remotes where reading the ModTime takes an extra
|
||||
request (eg s3, swift).
|
||||
|
||||
If --no-mimetype is specified then MimeType will be blank. This can speed things up on remotes where reading the MimeType takes an extra request (eg s3, swift).
|
||||
If --no-mimetype is specified then MimeType will be blank. This can
|
||||
speed things up on remotes where reading the MimeType takes an extra
|
||||
request (eg s3, swift).
|
||||
|
||||
If --encrypted is not specified the Encrypted won't be emitted.
|
||||
|
||||
If --dirs-only is not specified files in addition to directories are returned
|
||||
If --dirs-only is not specified files in addition to directories are
|
||||
returned
|
||||
|
||||
If --files-only is not specified directories in addition to the files will be returned.
|
||||
If --files-only is not specified directories in addition to the files
|
||||
will be returned.
|
||||
|
||||
The Path field will only show folders below the remote path being listed.
|
||||
If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
|
||||
|
||||
Reference in New Issue
Block a user