github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/docs/content/commands/rclone_lsf.md (about) 1 --- 2 title: "rclone lsf" 3 description: "List directories and objects in remote:path formatted for parsing." 4 slug: rclone_lsf 5 url: /commands/rclone_lsf/ 6 groups: Filter,Listing 7 versionIntroduced: v1.40 8 # autogenerated - DO NOT EDIT, instead edit the source code in cmd/lsf/ and as part of making a release run "make commanddocs" 9 --- 10 # rclone lsf 11 12 List directories and objects in remote:path formatted for parsing. 13 14 ## Synopsis 15 16 17 List the contents of the source path (directories and objects) to 18 standard output in a form which is easy to parse by scripts. By 19 default this will just be the names of the objects and directories, 20 one per line. The directories will have a / suffix. 21 22 Eg 23 24 $ rclone lsf swift:bucket 25 bevajer5jef 26 canole 27 diwogej7 28 ferejej3gux/ 29 fubuwic 30 31 Use the `--format` option to control what gets listed. By default this 32 is just the path, but you can use these parameters to control the 33 output: 34 35 p - path 36 s - size 37 t - modification time 38 h - hash 39 i - ID of object 40 o - Original ID of underlying object 41 m - MimeType of object if known 42 e - encrypted name 43 T - tier of storage if known, e.g. "Hot" or "Cool" 44 M - Metadata of object in JSON blob format, eg {"key":"value"} 45 46 So if you wanted the path, size and modification time, you would use 47 `--format "pst"`, or maybe `--format "tsp"` to put the path last. 48 49 Eg 50 51 $ rclone lsf --format "tsp" swift:bucket 52 2016-06-25 18:55:41;60295;bevajer5jef 53 2016-06-25 18:55:43;90613;canole 54 2016-06-25 18:55:43;94467;diwogej7 55 2018-04-26 08:50:45;0;ferejej3gux/ 56 2016-06-25 18:55:40;37600;fubuwic 57 58 If you specify "h" in the format you will get the MD5 hash by default, 59 use the `--hash` flag to change which hash you want. Note that this 60 can be returned as an empty string if it isn't available on the object 61 (and for directories), "ERROR" if there was an error reading it from 62 the object and "UNSUPPORTED" if that object does not support that hash 63 type. 64 65 For example, to emulate the md5sum command you can use 66 67 rclone lsf -R --hash MD5 --format hp --separator " " --files-only . 68 69 Eg 70 71 $ rclone lsf -R --hash MD5 --format hp --separator " " --files-only swift:bucket 72 7908e352297f0f530b84a756f188baa3 bevajer5jef 73 cd65ac234e6fea5925974a51cdd865cc canole 74 03b5341b4f234b9d984d03ad076bae91 diwogej7 75 8fd37c3810dd660778137ac3a66cc06d fubuwic 76 99713e14a4c4ff553acaf1930fad985b gixacuh7ku 77 78 (Though "rclone md5sum ." is an easier way of typing this.) 79 80 By default the separator is ";" this can be changed with the 81 `--separator` flag. Note that separators aren't escaped in the path so 82 putting it last is a good strategy. 83 84 Eg 85 86 $ rclone lsf --separator "," --format "tshp" swift:bucket 87 2016-06-25 18:55:41,60295,7908e352297f0f530b84a756f188baa3,bevajer5jef 88 2016-06-25 18:55:43,90613,cd65ac234e6fea5925974a51cdd865cc,canole 89 2016-06-25 18:55:43,94467,03b5341b4f234b9d984d03ad076bae91,diwogej7 90 2018-04-26 08:52:53,0,,ferejej3gux/ 91 2016-06-25 18:55:40,37600,8fd37c3810dd660778137ac3a66cc06d,fubuwic 92 93 You can output in CSV standard format. This will escape things in " 94 if they contain , 95 96 Eg 97 98 $ rclone lsf --csv --files-only --format ps remote:path 99 test.log,22355 100 test.sh,449 101 "this file contains a comma, in the file name.txt",6 102 103 Note that the `--absolute` parameter is useful for making lists of files 104 to pass to an rclone copy with the `--files-from-raw` flag. 105 106 For example, to find all the files modified within one day and copy 107 those only (without traversing the whole directory structure): 108 109 rclone lsf --absolute --files-only --max-age 1d /path/to/local > new_files 110 rclone copy --files-from-raw new_files /path/to/local remote:path 111 112 The default time format is `'2006-01-02 15:04:05'`. 113 [Other formats](https://pkg.go.dev/time#pkg-constants) can be specified with the `--time-format` flag. 114 Examples: 115 116 rclone lsf remote:path --format pt --time-format 'Jan 2, 2006 at 3:04pm (MST)' 117 rclone lsf remote:path --format pt --time-format '2006-01-02 15:04:05.000000000' 118 rclone lsf remote:path --format pt --time-format '2006-01-02T15:04:05.999999999Z07:00' 119 rclone lsf remote:path --format pt --time-format RFC3339 120 rclone lsf remote:path --format pt --time-format DateOnly 121 rclone lsf remote:path --format pt --time-format max 122 `--time-format max` will automatically truncate '`2006-01-02 15:04:05.000000000`' 123 to the maximum precision supported by the remote. 124 125 126 Any of the filtering options can be applied to this command. 127 128 There are several related list commands 129 130 * `ls` to list size and path of objects only 131 * `lsl` to list modification time, size and path of objects only 132 * `lsd` to list directories only 133 * `lsf` to list objects and directories in easy to parse format 134 * `lsjson` to list objects and directories in JSON format 135 136 `ls`,`lsl`,`lsd` are designed to be human-readable. 137 `lsf` is designed to be human and machine-readable. 138 `lsjson` is designed to be machine-readable. 139 140 Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion. 141 142 The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse. 143 144 Listing a nonexistent directory will produce an error except for 145 remotes which can't have empty directories (e.g. s3, swift, or gcs - 146 the bucket-based remotes). 147 148 149 ``` 150 rclone lsf remote:path [flags] 151 ``` 152 153 ## Options 154 155 ``` 156 --absolute Put a leading / in front of path names 157 --csv Output in CSV format 158 -d, --dir-slash Append a slash to directory names (default true) 159 --dirs-only Only list directories 160 --files-only Only list files 161 -F, --format string Output format - see help for details (default "p") 162 --hash h Use this hash when h is used in the format MD5|SHA-1|DropboxHash (default "md5") 163 -h, --help help for lsf 164 -R, --recursive Recurse into the listing 165 -s, --separator string Separator for the items in the format (default ";") 166 -t, --time-format string Specify a custom time format, or 'max' for max precision supported by remote (default: 2006-01-02 15:04:05) 167 ``` 168 169 170 ## Filter Options 171 172 Flags for filtering directory listings. 173 174 ``` 175 --delete-excluded Delete files on dest excluded from sync 176 --exclude stringArray Exclude files matching pattern 177 --exclude-from stringArray Read file exclude patterns from file (use - to read from stdin) 178 --exclude-if-present stringArray Exclude directories if filename is present 179 --files-from stringArray Read list of source-file names from file (use - to read from stdin) 180 --files-from-raw stringArray Read list of source-file names from file without any processing of lines (use - to read from stdin) 181 -f, --filter stringArray Add a file filtering rule 182 --filter-from stringArray Read file filtering patterns from a file (use - to read from stdin) 183 --ignore-case Ignore case in filters (case insensitive) 184 --include stringArray Include files matching pattern 185 --include-from stringArray Read file include patterns from file (use - to read from stdin) 186 --max-age Duration Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off) 187 --max-depth int If set limits the recursion depth to this (default -1) 188 --max-size SizeSuffix Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off) 189 --metadata-exclude stringArray Exclude metadatas matching pattern 190 --metadata-exclude-from stringArray Read metadata exclude patterns from file (use - to read from stdin) 191 --metadata-filter stringArray Add a metadata filtering rule 192 --metadata-filter-from stringArray Read metadata filtering patterns from a file (use - to read from stdin) 193 --metadata-include stringArray Include metadatas matching pattern 194 --metadata-include-from stringArray Read metadata include patterns from file (use - to read from stdin) 195 --min-age Duration Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off) 196 --min-size SizeSuffix Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off) 197 ``` 198 199 ## Listing Options 200 201 Flags for listing directories. 202 203 ``` 204 --default-time Time Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z) 205 --fast-list Use recursive list if available; uses more memory but fewer transactions 206 ``` 207 208 See the [global flags page](/flags/) for global options not listed here. 209 210 # SEE ALSO 211 212 * [rclone](/commands/rclone/) - Show help for rclone commands, flags and backends. 213