Unfortunately, s3cmd cannot delete files with a wildcard. You cannot just
s3cmd del s3://my-bucket/*
Well, you can, s3cmd will also report "Object * deleted" but all your files stay in the bucket!
I know why guys in Amazon decided to do so but that is a long story, let's go back to practice.
I suggest a unix-way here (well, I would suggest it anyway):
s3cmd ls s3://my-bucket/ | awk '{print $4}' | xargs s3cmd del
That is all, You will get list of files in an output.
Another way, is to "s3cmd sync" your bucket against an empty directory
Like you said, I think it's only as simple as this:
ReplyDeletes3cmd sync --recursive --delete-removed directory/ s3://mybucket-name/
This works well. Just sync with an empty directory and you're good to go.
Deletes3cmd del s3://bucketname/ --recursive
ReplyDeletearcseldon's solution worked perfectly for me, thanks!
ReplyDelete