vaibhavist
vaibhavist

Reputation: 71

proper s3 directory stucture in java

bucket1

I want to get folder1, folder2, file7 and file8 only. How do i get that? Basically I don't want all recursive folders/files in side a folder or bucket. Not very clear on the working of marker, delimiter and prefix.

I am trying:

    bucketName = "bucket1";
    prefix = "";
    delimiter = "";
    marker = "";
    ListObjectsRequest listObjectsRequest = new ListObjectsRequest()
            .withBucketName(bucketName).withPrefix(prefix)
            .withDelimiter(delimiter)
            .withMarker(marker)
            ;

Upvotes: 1

Views: 120

Answers (2)

vaibhavist
vaibhavist

Reputation: 71

I am able to get desired result using prefix = "" and delimiter = "/".

Upvotes: 2

ashokramcse
ashokramcse

Reputation: 2861

As of my knowledge you cant do this.

Since there is no file and folder architecture here all are treated as object. So you have to iterate over all the objects and you have to make your own logic to get your solution.

Upvotes: 2

Related Questions