Search code examples
amazon-web-servicesamazon-s3aws-clils

AWS s3 ls command is returning an extra row


When I do aws s3 ls s3://mybucket/folder, I'm getting an extra row. I'm expecting 6 rows, but am getting back 7. Output looks like:

2015-10-13 15:10:10  0    folder/
2015-10-13 15:10:10  12   folder/test1.txt
2015-10-13 15:10:10  123  folder/test2.txt
2015-10-13 15:10:10  53   folder/test3.txt
2015-10-13 15:10:10  12   folder/test4.txt
2015-10-13 15:10:10  42   folder/test5.txt
2015-10-13 15:10:10  12   folder/test6.txt

S3 doesn't show 7 items, it just shows 6. This was running perfectly fine an hour ago but suddenly started showing that first item just now


Solution

  • Often, software that manipulates Amazon S3 objects will create this mysterious zero-length object as a placeholder for a "folder", because Amazon S3 does not support folders in the normal sense.

    You might be able to delete it with aws s3 rm s3://mybucket/folder/. This will not delete the contents of the folder (since folders don't exist!).