问题
Somehow, using the AWS Java API, we managed to upload a file to S3 without a name.
The file is shown if we run s3cmd ls s3://myBucket/MyFolder
, but is not shown in the S3 GUI.
Running s3cmd del s3://myBucket/MyFolder/
give the following error:
ERROR: Parameter problem: Expecting S3 URI with a filename or --recursive: s3://myBucket/MyFolder/
Running the same command without the trailing slash does nothing.
How can the file be deleted?
回答1:
As far as I know, it can't be done using s3cmd.
It can be done using the aws cli, by running:
aws s3 rm 3://myBucket/MyFolder/
Make sure you don't use the --recursive
flag, or it will remove the entire directory.
来源:https://stackoverflow.com/questions/33753269/how-to-delete-a-file-with-an-empty-name-from-s3