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!
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!
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);
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);
Create or check for exist.
// Create object ends with '/' (also called as folder or directory).
minioClient.putObject(
PutObjectArgs.builder().bucket("my-bucketname").object("path/to/").stream(
new ByteArrayInputStream(new byte[] {}), 0, -1).build());
© 2022 - 2024 — McMap. All rights reserved.