Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a file with an empty name from S3

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?

like image 677
summerbulb Avatar asked Nov 17 '15 09:11

summerbulb


1 Answers

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.

like image 75
summerbulb Avatar answered Sep 30 '22 05:09

summerbulb