Copyto thinks local file is a directory

What is the problem you are having with rclone?

I'm trying to upload a single file.

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

rclone version
rclone v1.65.2
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-97-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.6
- go/linking: static
- go/tags: none

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

S3 / Cloudflare R2

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

rclone copyto -vvv --retries 1 "/etc/letsencrypt/live/ofm_ledns/fullchain.pem" "remote:ofm-secret/ledns/direct.openfreemap.org/ofm_ledns.cert"
[remote]
type = s3
provider = Cloudflare
access_key_id = XXX
secret_access_key = XXX
endpoint = https://XXX.r2.cloudflarestorage.com
no_check_bucket = true

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

2024/03/03 00:44:18 DEBUG : Setting --config "/data/ofm/config/rclone.conf" from environment variable RCLONE_CONFIG="/data/ofm/config/rclone.conf"
2024/03/03 00:44:18 DEBUG : rclone: Version "v1.65.2" starting with parameters ["rclone" "copyto" "-vvv" "--retries" "1" "/etc/letsencrypt/live/ofm_ledns/fullchain.pem" "remote:ofm-secret/ledns/direct.openfreemap.org/ofm_ledns.cert"]
2024/03/03 00:44:18 DEBUG : Creating backend with remote "/etc/letsencrypt/live/ofm_ledns/fullchain.pem"
2024/03/03 00:44:18 DEBUG : Using config file from "/data/ofm/config/rclone.conf"
2024/03/03 00:44:18 DEBUG : Creating backend with remote "remote:ofm-secret/ledns/direct.openfreemap.org/ofm_ledns.cert"
2024/03/03 00:44:18 DEBUG : Resolving service "s3" region "us-east-1"
2024/03/03 00:44:18 ERROR : Local file system at /etc/letsencrypt/live/ofm_ledns/fullchain.pem: error reading source root directory: failed to read directory entry: readdirent /etc/letsencrypt/live/ofm_ledns/fullchain.pem: not a directory
2024/03/03 00:44:18 DEBUG : S3 bucket ofm-secret path ledns/direct.openfreemap.org/ofm_ledns.cert: Waiting for checks to finish
2024/03/03 00:44:18 DEBUG : S3 bucket ofm-secret path ledns/direct.openfreemap.org/ofm_ledns.cert: Waiting for transfers to finish
2024/03/03 00:44:18 ERROR : Attempt 1/1 failed with 1 errors and: failed to read directory entry: readdirent /etc/letsencrypt/live/ofm_ledns/fullchain.pem: not a directory
2024/03/03 00:44:18 INFO  :
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.1s

2024/03/03 00:44:18 DEBUG : 7 go routines active
2024/03/03 00:44:18 Failed to copyto: failed to read directory entry: readdirent /etc/letsencrypt/live/ofm_ledns/fullchain.pem: not a directory

I believe this only happens because the source is a symlink.

lrwxrwxrwx 1 root root 38 Mar  3 00:20 /etc/letsencrypt/live/ofm_ledns/fullchain.pem -> ../../archive/ofm_ledns/fullchain1.pem

hi,
i just tried to rclone copyto a local file to wasabi, s3 clone, and that worked
so that is strange
what bout rclone copy, does that work?

I just tried, I can replicate this totally locally, like

rclone copyto /etc/letsencrypt/live/ofm_ledns/fullchain.pem test

The key is that the source is a symbolic link.

Copy on a file works the same. Copy on the source directory tells me

Can't follow symlink without -L/--copy-links

as a quick test, i just created a symlink to a file and tried to rclone copyto to wasabi

  • upload failed without --copy-links
  • upload completed using --copy-links

Yes, it works correctly with --copy-links. I'd recommend adding the same error message to copy and copyto when called on a file, as is shown when called on a directory.

I've been using rclone for many years, yet that error would have never shown me that I need --copy-links. Especially in this case, where I didn't know that the source is a symlink.

good point about that.

is the source directory a symlink?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.