aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Could not find a way to create folder in S3 bucket

Open search4mahesh opened this issue 13 years ago • 4 comments

HI,

There is no way available to create folder in Amazon S3

Please suggest.

search4mahesh avatar May 24 '13 11:05 search4mahesh

Hi,

First S3 is not file System.

However, you can use prefix of the key of the objects to organize and browse them hierarchically, similar to how a file system organizes files into directories.

For more information, you can read the Documentation of listObjects in http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/index.html

Hope it helps,

Thanks,

Yifei

yifeireplay avatar May 24 '13 23:05 yifeireplay

Amazon S3 doesn't have the concept of Folder and File, for it, everything is considered a resource. If you just put a resource on the location //, you can consider it a directory, if it is empty.

Here is a code snippet to spark your imagination:

Object metadata = new ObjectMetadata(); metadata.setContentType("binary/octet-stream"); amazonS3Client.putObject("", "", new ByteArrayInputStream(new byte[0]), metadata);

You have created a folder...

lc-nyovchev avatar May 25 '13 09:05 lc-nyovchev

I think this one can be closed out. Just browsing tickets; I'm not an admin nor moderator.

xpe avatar Jul 19 '13 06:07 xpe

+1 for closing

lc-nyovchev avatar Jul 19 '13 07:07 lc-nyovchev