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 copyurl downloads a URL straight to a remote

Rclone
~/tips/tip-rclone-copyurl

rclone copyurl https://example.com/files/big.iso remote:isos -a

Copies the content of a web URL directly to a remote without saving a temporary file.

Downloading a big file to my laptop only to upload it again is a silly detour. rclone copyurl skips the middle step.

rclone copyurl https://example.com/files/big.iso remote:isos -a

The URL’s content goes to the remote without being stored in temporary storage first. With -a (--auto-filename) the file name is taken from the URL, after any redirects. The command was added in v1.43.

Other flags from the docs: --no-clobber stops it from overwriting a file with the same name, --header-filename takes the name from the Content-Disposition header, and --stdout writes to standard output instead.

For several files, --urls reads a CSV with a URL and an optional file name per line. Those downloads run in parallel up to the --transfers limit. The caveat is that --print-filename and --stdout can’t be combined with --urls. If a site misbehaves, the docs suggest --disable-http2 or --user-agent curl.

I like it for big downloads that are headed for cloud storage anyway, like an ISO that has to land in a bucket.

The docs give this example for the CSV form:

rclone copyurl --urls myurls.csv remote:dir

With a line such as https://example.org/foo/bar.json,local/path/bar.json in the CSV, the file lands at remote:dir/local/path/bar.json, because the file name column is appended to the destination path. A missing file name is generated the way --auto-filename does it. -p (--print-filename) prints the resulting name when you use -a, which helps in scripts.

Further reading: rclone copyurl

More Rclone tips 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 rclone lsf -R --files-only --format tsp remote:photos All Rclone tips (14) All topics

Link