Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create folder inside a bucket in minio using JAVA SDK

Tags:

minio

The Minio JAVA SDK documentation doesn't clearly articulate how to create a folder inside a bucket.

Can somebody help me on this request ?

Thanks in Advance!

like image 613
Rakshith Venkatesh Avatar asked Jul 21 '26 18:07

Rakshith Venkatesh


2 Answers

In the objectName parameter prefix of the putObject method, you can specify a folder name. https://docs.minio.io/docs/java-client-api-reference#putObject https://github.com/minio/minio/issues/2423#issuecomment-239408168

For example:

//objectName = folderName + "/" + fileName;
minioClient.putObject(bucketName, objectName, inputStream, contentType);
like image 52
Maxim Shatunov Avatar answered Jul 23 '26 14:07

Maxim Shatunov


Create the bucket if its not present. To add folder within it add it to the name of file. Eg. File name: "sample.txt", Bucket Name: "main", SubFolder: "resrc" filePath: file which you want to upload

minioClient.putObject("main", "resrc" + "/" + "sample.txt", filePath);

like image 27
Rumi singh Avatar answered Jul 23 '26 13:07

Rumi singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!