Reputation: 143
I am making a webapp that communicates to AWS S3 SDK to upload files from my webapp to S3 Bucket. So far it worked like a charm but I have something I want to do. I want to group it in years like 2018
folder and 2019
folder.
If I will upload a file to S3 Bucket, it will be saved to a folder on what year it is being uploaded.
Does anyone know about it? Thank you!
Upvotes: 0
Views: 247
Reputation: 269360
Amazon S3 does not support folders/directories.
Instead, the filename ('Key') of each object includes the full path.
For example, you could upload a new object with a Key of:
2019/foo.txt
The object would 'appear' to be in a folder called 2019
, but it doesn't actually exist. If the object is deleted and there are no other objects in the 2019
folder, then the folder will disappear too.
Therefore, you can just upload objects to whatever location you wish, without having to actually create the directories.
Simply code your application to store the object with a Key that contains the full path.
Upvotes: 1