github.com/xhghs/rclone@v1.51.1-0.20200430155106-e186a28cced8/docs/content/commands/rclone_lsjson.md (about)

     1  ---
     2  date: 2020-02-01T10:26:53Z
     3  title: "rclone lsjson"
     4  slug: rclone_lsjson
     5  url: /commands/rclone_lsjson/
     6  ---
     7  ## rclone lsjson
     8  
     9  List directories and objects in the path in JSON format.
    10  
    11  ### Synopsis
    12  
    13  List directories and objects in the path in JSON format.
    14  
    15  The output is an array of Items, where each Item looks like this
    16  
    17     {
    18        "Hashes" : {
    19           "SHA-1" : "f572d396fae9206628714fb2ce00f72e94f2258f",
    20           "MD5" : "b1946ac92492d2347c6235b4d2611184",
    21           "DropboxHash" : "ecb65bb98f9d905b70458986c39fcbad7715e5f2fcc3b1f07767d7c83e2438cc"
    22        },
    23        "ID": "y2djkhiujf83u33",
    24        "OrigID": "UYOJVTUW00Q1RzTDA",
    25        "IsBucket" : false,
    26        "IsDir" : false,
    27        "MimeType" : "application/octet-stream",
    28        "ModTime" : "2017-05-31T16:15:57.034468261+01:00",
    29        "Name" : "file.txt",
    30        "Encrypted" : "v0qpsdq8anpci8n929v3uu9338",
    31        "EncryptedPath" : "kja9098349023498/v0qpsdq8anpci8n929v3uu9338",
    32        "Path" : "full/path/goes/here/file.txt",
    33        "Size" : 6,
    34        "Tier" : "hot",
    35     }
    36  
    37  If --hash is not specified the Hashes property won't be emitted.
    38  
    39  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).
    40  
    41  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).
    42  
    43  If --encrypted is not specified the Encrypted won't be emitted.
    44  
    45  If --dirs-only is not specified files in addition to directories are returned
    46  
    47  If --files-only is not specified directories in addition to the files will be returned.
    48  
    49  The Path field will only show folders below the remote path being listed.
    50  If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
    51  will be "subfolder/file.txt", not "remote:path/subfolder/file.txt".
    52  When used without --recursive the Path will always be the same as Name.
    53  
    54  If the directory is a bucket in a bucket based backend, then
    55  "IsBucket" will be set to true. This key won't be present unless it is
    56  "true".
    57  
    58  The time is in RFC3339 format with up to nanosecond precision.  The
    59  number of decimal digits in the seconds will depend on the precision
    60  that the remote can hold the times, so if times are accurate to the
    61  nearest millisecond (eg Google Drive) then 3 digits will always be
    62  shown ("2017-05-31T16:15:57.034+01:00") whereas if the times are
    63  accurate to the nearest second (Dropbox, Box, WebDav etc) no digits
    64  will be shown ("2017-05-31T16:15:57+01:00").
    65  
    66  The whole output can be processed as a JSON blob, or alternatively it
    67  can be processed line by line as each item is written one to a line.
    68  
    69  Any of the filtering options can be applied to this command.
    70  
    71  There are several related list commands
    72  
    73    * `ls` to list size and path of objects only
    74    * `lsl` to list modification time, size and path of objects only
    75    * `lsd` to list directories only
    76    * `lsf` to list objects and directories in easy to parse format
    77    * `lsjson` to list objects and directories in JSON format
    78  
    79  `ls`,`lsl`,`lsd` are designed to be human readable.
    80  `lsf` is designed to be human and machine readable.
    81  `lsjson` is designed to be machine readable.
    82  
    83  Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
    84  
    85  The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
    86  
    87  Listing a non existent directory will produce an error except for
    88  remotes which can't have empty directories (eg s3, swift, gcs, etc -
    89  the bucket based remotes).
    90  
    91  
    92  ```
    93  rclone lsjson remote:path [flags]
    94  ```
    95  
    96  ### Options
    97  
    98  ```
    99        --dirs-only     Show only directories in the listing.
   100    -M, --encrypted     Show the encrypted names.
   101        --files-only    Show only files in the listing.
   102        --hash          Include hashes in the output (may take longer).
   103    -h, --help          help for lsjson
   104        --no-mimetype   Don't read the mime type (can speed things up).
   105        --no-modtime    Don't read the modification time (can speed things up).
   106        --original      Show the ID of the underlying Object.
   107    -R, --recursive     Recurse into the listing.
   108  ```
   109  
   110  See the [global flags page](/flags/) for global options not listed here.
   111  
   112  ### SEE ALSO
   113  
   114  * [rclone](/commands/rclone/)	 - Show help for rclone commands, flags and backends.
   115