I am trying to open a folder in Bucket.
Yes, folder is opening but problem occurs. For example ;
My folder name is "test" folder is opening like : test/test
Basically, when opening a folder, it opens the same folder inside the folder.
Code :
String delimiter = "/";
PutObjectRequest putObjectRequest = new PutObjectRequest
{
BucketName = _bucketName,
Key = string.Concat(createDirectoryRequest.FolderName, delimiter),
InputStream = new MemoryStream(new byte[0]),
};
var response = await _client.PutObjectAsync(putObjectRequest).ConfigureAwait(false);
CodePudding user response:
Folders do not actually exist in Amazon S3. You can upload a file to any location (eg mehmet/invoices/january/file.txt
) and it will be successfully created.
If users do need an empty folder, they can be created in the Amazon S3 management console (and presumably the same applies to minio). This operation actually creates a zero-length object with the same name as the folder, which forces the 'folder' to appear in a listing. However, it is normally best to avoid creating these 'pretend' folders.
So, just upload your file to where you want it to be, and it will be successful regardless of whether folders already exist.