John Newman
John Newman

Reputation: 21

AWS s3 bucket shows 1 file less

I have used aws cli tool to move couple of folders named: 2014, 2015, 2016 etc from root directory:

/2015/

into:

/images/2015/

When I moved them it seems that there is one file less in each bucket:

Before copying:

Screenshot from 2021-03-26 10-33-36

After coping:

Screenshot from 2021-03-26 10-33-47

Could you help me to understand this phenomena ?

Upvotes: 2

Views: 213

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269322

The count is probably including/excluding the 'folder object'.

Normally, there is no need to create folders in Amazon S3. Simply putting an object in a particular path (eg /images/2014 will "create" the images and 2014 folders -- they 'appear' to exist, but they actually do not exist. Deleting the objects will make the folders disappear.

However, it is possible to create a folder by clicking Create folder. This will create a zero-length object with the same name as the folder. This will force the folder to appear, even when there are no objects inside the folder.

Therefore, it is likely that the "off by 1" count of objects is related to a folder that was/wasn't created via the Create folder command. I have previously seen exactly this behaviour.

Upvotes: 2

Related Questions