Hiccup
(Hiccup)
November 29, 2021, 5:59pm
1
What is the problem you are having with rclone?
Is there a way to prevent copying a file if it would overwrite an existing one in the destination? For now I am using --interactive
, but that prompts even if the file doesn't exist.
What is your rclone version (output from rclone version
)
rclone v1.57.0
Which cloud storage system are you using? (eg Google Drive)
N/A
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
rclone copy remote:'path/to/file' .
The rclone config contents with secrets removed.
N/A
A log from the command with the -vv
flag
N/A
I guess it depends on your criteria.
If the file exists and is newer on the remote, you can use:
-u, --update Skip files that are newer on the destination
What is your method for deciding to overwrite it or not?
Hiccup
(Hiccup)
November 29, 2021, 8:01pm
3
Well my criteria is just "does a file by this name exist locally?". If it does, then it give a "file already exists" error, and not go ahead with the copy.
So you have source and remote.
Source has a file called test.txt
Destination has a file called test.txt
If test.txt exists on the destination, never overwrite it?
Hiccup
(Hiccup)
November 29, 2021, 10:03pm
5
Correct. Or certainly not unless you are on interactive mode and you explicitly choose to. In normal mode, it should display an error, informing you that the file already exists.
I think you want --immutable but there is a single copy bug:
--immutable Do not modify files, fail if existing files have been modified
opened 10:49AM - 11 Jan 21 UTC
bug
change detection
#### What is the problem you are having with rclone?
Immutable does not work … outside of `sync`.
[Docs](https://rclone.org/docs/#immutable) say that
`Note that only commands which transfer files (e.g. sync, copy, move) are affected by this behavior, and only modification is disallowed.
`
Currently immutable is supported in `syncCopyMove` instances, on the other hand `moveOrCopyFile` has no awareness of it.
#### What is your rclone version (output from `rclone version`)
1.53.3 / master
felix@gemini:~/test$ rclone copy /home/felix/test GD: -vv --immutable
2021/11/29 17:11:01 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2021/11/29 17:11:01 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "copy" "/home/felix/test" "GD:" "-vv" "--immutable"]
2021/11/29 17:11:01 DEBUG : Creating backend with remote "/home/felix/test"
2021/11/29 17:11:01 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2021/11/29 17:11:01 DEBUG : Creating backend with remote "GD:"
2021/11/29 17:11:01 DEBUG : Google drive root '': Waiting for checks to finish
2021/11/29 17:11:01 DEBUG : hosts: Sizes differ (src 49 vs dst 41)
2021/11/29 17:11:01 ERROR : hosts: Source and destination exist but do not match: immutable file modified
2021/11/29 17:11:01 DEBUG : Google drive root '': Waiting for transfers to finish
2021/11/29 17:11:01 ERROR : Can't retry any of the errors - not attempting retries
2021/11/29 17:11:01 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (no need to retry)
Checks: 1 / 1, 100%
Elapsed time: 0.2s
2021/11/29 17:11:01 DEBUG : 4 go routines active
2021/11/29 17:11:01 Failed to copy: immutable file modified
asdffdsa
(jojothehumanmonkey)
November 29, 2021, 10:18pm
7
hi,
just curious as to why this was not suggested --ignore-existing
"will make rclone unconditionally skip all files that exist on the destination, no matter the content of these files."
Based on the OP asked for an error.
ignore existing doesn't give an error:
felix@gemini:~$ rclone sync /home/felix/test GD:test --ignore-existing -vv
2021/11/29 17:20:54 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2021/11/29 17:20:54 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "sync" "/home/felix/test" "GD:test" "--ignore-existing" "-vv"]
2021/11/29 17:20:54 DEBUG : Creating backend with remote "/home/felix/test"
2021/11/29 17:20:54 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2021/11/29 17:20:54 DEBUG : Creating backend with remote "GD:test"
2021/11/29 17:20:54 DEBUG : Google drive root 'test': Waiting for checks to finish
2021/11/29 17:20:54 DEBUG : hosts: Destination exists, skipping
2021/11/29 17:20:54 DEBUG : Google drive root 'test': Waiting for transfers to finish
2021/11/29 17:20:54 DEBUG : Waiting for deletions to finish
2021/11/29 17:20:54 INFO : There was nothing to transfer
2021/11/29 17:20:54 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Checks: 1 / 1, 100%
Elapsed time: 0.5s
2021/11/29 17:20:54 DEBUG : 4 go routines active
felix@gemini:~$ echo $?
0
while
rclone sync /home/felix/test GD:test --immutable -vv
2021/11/29 17:22:11 DEBUG : Setting --config "/opt/rclone/rclone.conf" from environment variable RCLONE_CONFIG="/opt/rclone/rclone.conf"
2021/11/29 17:22:11 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "sync" "/home/felix/test" "GD:test" "--immutable" "-vv"]
2021/11/29 17:22:11 DEBUG : Creating backend with remote "/home/felix/test"
2021/11/29 17:22:11 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2021/11/29 17:22:11 DEBUG : Creating backend with remote "GD:test"
2021/11/29 17:22:12 DEBUG : hosts: Sizes differ (src 40 vs dst 49)
2021/11/29 17:22:12 ERROR : hosts: Source and destination exist but do not match: immutable file modified
2021/11/29 17:22:12 DEBUG : Google drive root 'test': Waiting for checks to finish
2021/11/29 17:22:12 DEBUG : Google drive root 'test': Waiting for transfers to finish
2021/11/29 17:22:12 ERROR : Google drive root 'test': not deleting files as there were IO errors
2021/11/29 17:22:12 ERROR : Google drive root 'test': not deleting directories as there were IO errors
2021/11/29 17:22:12 ERROR : Can't retry any of the errors - not attempting retries
2021/11/29 17:22:12 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (no need to retry)
Checks: 1 / 1, 100%
Elapsed time: 0.5s
2021/11/29 17:22:12 DEBUG : 4 go routines active
2021/11/29 17:22:12 Failed to sync: immutable file modified
felix@gemini:~/test$ echo $?
6
Does.
Hiccup
(Hiccup)
November 30, 2021, 2:52pm
10
Thanks, I guess i will wait for --immutable to be fixed.
system
(system)
Closed
December 30, 2021, 2:52pm
11
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.