github.com/ncw/rclone@v1.48.1-0.20190724201158-a35aa1360e3e/docs/content/commands/rclone_lsf.md (about)

     1  ---
     2  date: 2019-06-20T16:09:42+01:00
     3  title: "rclone lsf"
     4  slug: rclone_lsf
     5  url: /commands/rclone_lsf/
     6  ---
     7  ## rclone lsf
     8  
     9  List directories and objects in remote:path formatted for parsing
    10  
    11  ### Synopsis
    12  
    13  
    14  List the contents of the source path (directories and objects) to
    15  standard output in a form which is easy to parse by scripts.  By
    16  default this will just be the names of the objects and directories,
    17  one per line.  The directories will have a / suffix.
    18  
    19  Eg
    20  
    21      $ rclone lsf swift:bucket
    22      bevajer5jef
    23      canole
    24      diwogej7
    25      ferejej3gux/
    26      fubuwic
    27  
    28  Use the --format option to control what gets listed.  By default this
    29  is just the path, but you can use these parameters to control the
    30  output:
    31  
    32      p - path
    33      s - size
    34      t - modification time
    35      h - hash
    36      i - ID of object
    37      o - Original ID of underlying object
    38      m - MimeType of object if known
    39      e - encrypted name
    40      T - tier of storage if known, eg "Hot" or "Cool"
    41  
    42  So if you wanted the path, size and modification time, you would use
    43  --format "pst", or maybe --format "tsp" to put the path last.
    44  
    45  Eg
    46  
    47      $ rclone lsf  --format "tsp" swift:bucket
    48      2016-06-25 18:55:41;60295;bevajer5jef
    49      2016-06-25 18:55:43;90613;canole
    50      2016-06-25 18:55:43;94467;diwogej7
    51      2018-04-26 08:50:45;0;ferejej3gux/
    52      2016-06-25 18:55:40;37600;fubuwic
    53  
    54  If you specify "h" in the format you will get the MD5 hash by default,
    55  use the "--hash" flag to change which hash you want.  Note that this
    56  can be returned as an empty string if it isn't available on the object
    57  (and for directories), "ERROR" if there was an error reading it from
    58  the object and "UNSUPPORTED" if that object does not support that hash
    59  type.
    60  
    61  For example to emulate the md5sum command you can use
    62  
    63      rclone lsf -R --hash MD5 --format hp --separator "  " --files-only .
    64  
    65  Eg
    66  
    67      $ rclone lsf -R --hash MD5 --format hp --separator "  " --files-only swift:bucket 
    68      7908e352297f0f530b84a756f188baa3  bevajer5jef
    69      cd65ac234e6fea5925974a51cdd865cc  canole
    70      03b5341b4f234b9d984d03ad076bae91  diwogej7
    71      8fd37c3810dd660778137ac3a66cc06d  fubuwic
    72      99713e14a4c4ff553acaf1930fad985b  gixacuh7ku
    73  
    74  (Though "rclone md5sum ." is an easier way of typing this.)
    75  
    76  By default the separator is ";" this can be changed with the
    77  --separator flag.  Note that separators aren't escaped in the path so
    78  putting it last is a good strategy.
    79  
    80  Eg
    81  
    82      $ rclone lsf  --separator "," --format "tshp" swift:bucket
    83      2016-06-25 18:55:41,60295,7908e352297f0f530b84a756f188baa3,bevajer5jef
    84      2016-06-25 18:55:43,90613,cd65ac234e6fea5925974a51cdd865cc,canole
    85      2016-06-25 18:55:43,94467,03b5341b4f234b9d984d03ad076bae91,diwogej7
    86      2018-04-26 08:52:53,0,,ferejej3gux/
    87      2016-06-25 18:55:40,37600,8fd37c3810dd660778137ac3a66cc06d,fubuwic
    88  
    89  You can output in CSV standard format.  This will escape things in "
    90  if they contain ,
    91  
    92  Eg
    93  
    94      $ rclone lsf --csv --files-only --format ps remote:path
    95      test.log,22355
    96      test.sh,449
    97      "this file contains a comma, in the file name.txt",6
    98  
    99  Note that the --absolute parameter is useful for making lists of files
   100  to pass to an rclone copy with the --files-from flag.
   101  
   102  For example to find all the files modified within one day and copy
   103  those only (without traversing the whole directory structure):
   104  
   105      rclone lsf --absolute --files-only --max-age 1d /path/to/local > new_files
   106      rclone copy --files-from new_files /path/to/local remote:path
   107  
   108  
   109  Any of the filtering options can be applied to this command.
   110  
   111  There are several related list commands
   112  
   113    * `ls` to list size and path of objects only
   114    * `lsl` to list modification time, size and path of objects only
   115    * `lsd` to list directories only
   116    * `lsf` to list objects and directories in easy to parse format
   117    * `lsjson` to list objects and directories in JSON format
   118  
   119  `ls`,`lsl`,`lsd` are designed to be human readable.
   120  `lsf` is designed to be human and machine readable.
   121  `lsjson` is designed to be machine readable.
   122  
   123  Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
   124  
   125  The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
   126  
   127  Listing a non existent directory will produce an error except for
   128  remotes which can't have empty directories (eg s3, swift, gcs, etc -
   129  the bucket based remotes).
   130  
   131  
   132  ```
   133  rclone lsf remote:path [flags]
   134  ```
   135  
   136  ### Options
   137  
   138  ```
   139        --absolute           Put a leading / in front of path names.
   140        --csv                Output in CSV format.
   141    -d, --dir-slash          Append a slash to directory names. (default true)
   142        --dirs-only          Only list directories.
   143        --files-only         Only list files.
   144    -F, --format string      Output format - see  help for details (default "p")
   145        --hash h             Use this hash when h is used in the format MD5|SHA-1|DropboxHash (default "MD5")
   146    -h, --help               help for lsf
   147    -R, --recursive          Recurse into the listing.
   148    -s, --separator string   Separator for the items in the format. (default ";")
   149  ```
   150  
   151  See the [global flags page](/flags/) for global options not listed here.
   152  
   153  ### SEE ALSO
   154  
   155  * [rclone](/commands/rclone/)	 - Show help for rclone commands, flags and backends.
   156