0

I'm working on a simple project to download all files with certain extensions. And I'm doing a search like this

public void findFile(String query){
        try{

            SearchV2Builder searchBuilder = client.files().searchV2Builder(query);

            List<String> fileExtensions = Arrays.asList(extensions);
            SearchOptions searchOptions = SearchOptions.newBuilder().withFileExtensions(fileExtensions).build();

            SearchV2Result searchResult = searchBuilder.withOptions(searchOptions).start();
            List<SearchMatchV2> searchMatches = searchResult.getMatches();

            System.out.println(searchMatches.size());
            for (SearchMatchV2 s: searchMatches){
                System.out.println(s.getMetadata());
            }

        }
        catch(DbxException e){
            e.printStackTrace();
        }

    }

And i don't know how to write query to get all the files I tried "*" "" and none of it worked. How to wrote correct query for that?

1

1 Answer 1

0

In my experience, you have to include in your initial search string something you are specifically looking for - there does not seem to be the notion of a "wildcard" search in this string.

Also, there is no way to limit the query by date.

So for my usage, I always have directories that start with a known string ("p_"), and also include a YYYYMMDD string in them.

To return all directories, I query "p_" only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.