brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: rclone lsf prints a plain file listing that scripts can read

Rclone
~/tips/tip-rclone-lsf-script-listing

rclone lsf -R --files-only --format tsp remote:photos

Lists remote files with exactly the columns you ask for.

rclone ls is fine for eyes. For a script I want one line per file with only the fields I chose, and that is what lsf does.

By default it prints names in the current folder. Add recursion, limit it to files and pick columns:

rclone lsf -R --files-only --format tsp remote:photos

t is the modification time, s the size and p the path, in the order you list them. The separator is a semicolon unless you change it with --separator. Paths aren’t escaped, so put p last, and a filename containing the separator can’t confuse the columns before it.

For a spreadsheet, ask for CSV, which quotes awkward names properly:

rclone lsf -R --files-only --csv --format ps remote:photos > files.csv

A trick I like: save a listing today, save another next week, and diff the two sorted files to see what appeared or vanished on the remote.

rclone lsf -R --files-only remote:photos | sort > today.txt

Other letters give hashes (h), MIME types (m) and object IDs (i). Not every backend can supply all of them, and asking for hashes on some, such as a local disk, means reading every file, so a big tree gets slow.

Further reading: rclone lsf

More Rclone tips rclone copyurl https://example.com/files/big.iso remote:isos -a rclone size remote:photos rclone config redacted rclone ncdu remote:backup rclone copy /data remote:data --bwlimit "08:00,1M 18:00,5M 23:00,off" -P All Rclone tips (14) All topics

Link