github.com/artpar/rclone@v1.67.3/docs/content/commands/rclone_lsjson.md (about) 1 --- 2 title: "rclone lsjson" 3 description: "List directories and objects in the path in JSON format." 4 slug: rclone_lsjson 5 url: /commands/rclone_lsjson/ 6 groups: Filter,Listing 7 versionIntroduced: v1.37 8 # autogenerated - DO NOT EDIT, instead edit the source code in cmd/lsjson/ and as part of making a release run "make commanddocs" 9 --- 10 # rclone lsjson 11 12 List directories and objects in the path in JSON format. 13 14 ## Synopsis 15 16 List directories and objects in the path in JSON format. 17 18 The output is an array of Items, where each Item looks like this 19 20 { 21 "Hashes" : { 22 "SHA-1" : "f572d396fae9206628714fb2ce00f72e94f2258f", 23 "MD5" : "b1946ac92492d2347c6235b4d2611184", 24 "DropboxHash" : "ecb65bb98f9d905b70458986c39fcbad7715e5f2fcc3b1f07767d7c83e2438cc" 25 }, 26 "ID": "y2djkhiujf83u33", 27 "OrigID": "UYOJVTUW00Q1RzTDA", 28 "IsBucket" : false, 29 "IsDir" : false, 30 "MimeType" : "application/octet-stream", 31 "ModTime" : "2017-05-31T16:15:57.034468261+01:00", 32 "Name" : "file.txt", 33 "Encrypted" : "v0qpsdq8anpci8n929v3uu9338", 34 "EncryptedPath" : "kja9098349023498/v0qpsdq8anpci8n929v3uu9338", 35 "Path" : "full/path/goes/here/file.txt", 36 "Size" : 6, 37 "Tier" : "hot", 38 } 39 40 If `--hash` is not specified the Hashes property won't be emitted. The 41 types of hash can be specified with the `--hash-type` parameter (which 42 may be repeated). If `--hash-type` is set then it implies `--hash`. 43 44 If `--no-modtime` is specified then ModTime will be blank. This can 45 speed things up on remotes where reading the ModTime takes an extra 46 request (e.g. s3, swift). 47 48 If `--no-mimetype` is specified then MimeType will be blank. This can 49 speed things up on remotes where reading the MimeType takes an extra 50 request (e.g. s3, swift). 51 52 If `--encrypted` is not specified the Encrypted won't be emitted. 53 54 If `--dirs-only` is not specified files in addition to directories are 55 returned 56 57 If `--files-only` is not specified directories in addition to the files 58 will be returned. 59 60 If `--metadata` is set then an additional Metadata key will be returned. 61 This will have metadata in rclone standard format as a JSON object. 62 63 if `--stat` is set then a single JSON blob will be returned about the 64 item pointed to. This will return an error if the item isn't found. 65 However on bucket based backends (like s3, gcs, b2, azureblob etc) if 66 the item isn't found it will return an empty directory as it isn't 67 possible to tell empty directories from missing directories there. 68 69 The Path field will only show folders below the remote path being listed. 70 If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt" 71 will be "subfolder/file.txt", not "remote:path/subfolder/file.txt". 72 When used without `--recursive` the Path will always be the same as Name. 73 74 If the directory is a bucket in a bucket-based backend, then 75 "IsBucket" will be set to true. This key won't be present unless it is 76 "true". 77 78 The time is in RFC3339 format with up to nanosecond precision. The 79 number of decimal digits in the seconds will depend on the precision 80 that the remote can hold the times, so if times are accurate to the 81 nearest millisecond (e.g. Google Drive) then 3 digits will always be 82 shown ("2017-05-31T16:15:57.034+01:00") whereas if the times are 83 accurate to the nearest second (Dropbox, Box, WebDav, etc.) no digits 84 will be shown ("2017-05-31T16:15:57+01:00"). 85 86 The whole output can be processed as a JSON blob, or alternatively it 87 can be processed line by line as each item is written one to a line. 88 89 Any of the filtering options can be applied to this command. 90 91 There are several related list commands 92 93 * `ls` to list size and path of objects only 94 * `lsl` to list modification time, size and path of objects only 95 * `lsd` to list directories only 96 * `lsf` to list objects and directories in easy to parse format 97 * `lsjson` to list objects and directories in JSON format 98 99 `ls`,`lsl`,`lsd` are designed to be human-readable. 100 `lsf` is designed to be human and machine-readable. 101 `lsjson` is designed to be machine-readable. 102 103 Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion. 104 105 The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse. 106 107 Listing a nonexistent directory will produce an error except for 108 remotes which can't have empty directories (e.g. s3, swift, or gcs - 109 the bucket-based remotes). 110 111 112 ``` 113 rclone lsjson remote:path [flags] 114 ``` 115 116 ## Options 117 118 ``` 119 --dirs-only Show only directories in the listing 120 --encrypted Show the encrypted names 121 --files-only Show only files in the listing 122 --hash Include hashes in the output (may take longer) 123 --hash-type stringArray Show only this hash type (may be repeated) 124 -h, --help help for lsjson 125 -M, --metadata Add metadata to the listing 126 --no-mimetype Don't read the mime type (can speed things up) 127 --no-modtime Don't read the modification time (can speed things up) 128 --original Show the ID of the underlying Object 129 -R, --recursive Recurse into the listing 130 --stat Just return the info for the pointed to file 131 ``` 132 133 134 ## Filter Options 135 136 Flags for filtering directory listings. 137 138 ``` 139 --delete-excluded Delete files on dest excluded from sync 140 --exclude stringArray Exclude files matching pattern 141 --exclude-from stringArray Read file exclude patterns from file (use - to read from stdin) 142 --exclude-if-present stringArray Exclude directories if filename is present 143 --files-from stringArray Read list of source-file names from file (use - to read from stdin) 144 --files-from-raw stringArray Read list of source-file names from file without any processing of lines (use - to read from stdin) 145 -f, --filter stringArray Add a file filtering rule 146 --filter-from stringArray Read file filtering patterns from a file (use - to read from stdin) 147 --ignore-case Ignore case in filters (case insensitive) 148 --include stringArray Include files matching pattern 149 --include-from stringArray Read file include patterns from file (use - to read from stdin) 150 --max-age Duration Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off) 151 --max-depth int If set limits the recursion depth to this (default -1) 152 --max-size SizeSuffix Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off) 153 --metadata-exclude stringArray Exclude metadatas matching pattern 154 --metadata-exclude-from stringArray Read metadata exclude patterns from file (use - to read from stdin) 155 --metadata-filter stringArray Add a metadata filtering rule 156 --metadata-filter-from stringArray Read metadata filtering patterns from a file (use - to read from stdin) 157 --metadata-include stringArray Include metadatas matching pattern 158 --metadata-include-from stringArray Read metadata include patterns from file (use - to read from stdin) 159 --min-age Duration Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off) 160 --min-size SizeSuffix Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off) 161 ``` 162 163 ## Listing Options 164 165 Flags for listing directories. 166 167 ``` 168 --default-time Time Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z) 169 --fast-list Use recursive list if available; uses more memory but fewer transactions 170 ``` 171 172 See the [global flags page](/flags/) for global options not listed here. 173 174 # SEE ALSO 175 176 * [rclone](/commands/rclone/) - Show help for rclone commands, flags and backends. 177