s4cmd icon indicating copy to clipboard operation
s4cmd copied to clipboard

Do not throw exception if file exists

Open ralphholz opened this issue 5 years ago • 2 comments

Version from pip3 - 2.1.0 - crashes when a file already exists in the bucket:

(s4cmd) $ s4cmd put bla.zip s3://bla/bla/
[Runtime Failure] File already exists: s3://bla/bla/bla.zip
Exception in thread Thread-1:ead(s)]
Traceback (most recent call last):
[Thread Failure] File already exists: s3://bla/bla/bla.zip

I wonder if an exception is unavoidable or if s3 can return an error to evaluate. I also think the exception needs to be caught and treated.

ralphholz avatar Feb 16 '21 01:02 ralphholz

@ralphholz did you find any work arounds for this?

kishaningithub avatar Apr 11 '23 13:04 kishaningithub

Found the workaround...

For those who stumble on this issue, the workaround is to use the --force flag when performing put operation, this flag makes sure that the command succeeds even if the file already exists

https://github.com/bloomreach/s4cmd#s4cmd-put-source-target

kishaningithub avatar Apr 11 '23 13:04 kishaningithub