Reputation: 1004
I try to upload files to my S3 Bucket using the s3cmd. Works fine as it should, but files which already exist will not be overwritten but saved as a new file like "filename-1.ext".
I have found the
-f, --force (Force overwrite and other dangerous operations.)
command at http://s3tools.org/usage and tried
s3cmd put ~/Desktop/filename.ext s3://mybucket -f
but files are still saved as new and not overwritten. Does anyone have any idea? Thanks for your help!
Upvotes: 5
Views: 5869
Reputation: 1964
You can use mc (a.k.a. Minio client). It’s written in Golang & available under the Open Source Apache License. It is available for Mac, Linux, Windows, and FreeBSD. You can use the mc cp
command to achieve your requirement.
64-bit Intel from https://dl.minio.io/client/mc/release/linux-amd64/mc
32-bit Intel from https://dl.minio.io/client/mc/release/linux-386/mc
32-bit ARM from https://dl.minio.io/client/mc/release/linux-arm/mc
$ chmod +x mc
$ ./mc --help
$ mc config host add mys3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
Overwrite your object name myfile.txt
to Amazon S3 bucket name mybucket
./mc cp myfile.txt mys3/mybucket
Hope it helps.
Disclaimer: I work for Minio
Upvotes: 1
Reputation: 54
Delete the existing file first: s3cmd del s3://bucket/file
then put the new file.
Upvotes: 1
Reputation: 270224
These days it is recommended to use the AWS Command-Line Interface (CLI).
It has an aws s3 cp
command that always retains the requested name.
Upvotes: 1