How to specify metadata (file content type) automatically?

What is the problem you are having with rclone?

I’m trying to upload large amount of files with different extensions. Some extensions are documented in IANA while others are custom and unknown to the public. After uploading, I realize the server not returning any content-type, and contacted support. They said that I have to specify the content type during upload.

Question, is there any way to supply a mapping file, so rclone will upload file.ext1 as application/type1, file.ext2 as application/type2…and so on?

I have found the option --metadata-set but after reading the doc, it looks like that I still have to manually specify over the command line, but I am uploading the entire folder (over 2 million files), have no time to do that.

Run the command 'rclone version' and share the full output of the command.

rclone v1.71.0

  • os/version: redhat 10.0 (64 bit)
  • os/kernel: 6.12.0-55.41.1.el10_0.x86_64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.24.6 (Red Hat 1.24.6-1.el10)
  • go/linking: dynamic
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

R2 (S3 compatible)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync /data10/ r2:/dst/f1 -u -P -L --progress-terminal-title --ignore-checksum --retries=1 --checkers=16 --fast-list --transfers=64

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

``
[r2]
type = s3
provider = Cloudflare
access_key_id = XXX
secret_access_key = XXX
endpoint = https://xxx.r2.cloudflarestorage.com
region = auto
no_check_bucket = true

A log from the command that you were trying to run with the -vv flag

n/a