Reputation: 121760
I am using the Java SDK (version 3.1.7) and cannot seem to find a way to find a file by path; the only way seems to be to walk through the root, check that the name exists, that it is a directory, pick its id, goto 1.
Also, there doesn't seem to be a search option for that either.
So, is it possible at all?
Upvotes: 3
Views: 1838
Reputation: 3741
You're correct - the only way to find a file by path is to recursively walk the user's file tree. However, we do have a new beta version of our SDK that makes it easier to iterate over folders. It also includes a small example showing how you would go about walking the user's account.
The reason why the SDK doesn't provide this functionality is because searching for files/folders by path can be really inefficient. It would be really easy to inadvertently call getItemByPath("/path/to/my/file")
not realizing it will require at least 4 API requests (at least one for each folder). In general, you should try to access items by their ID instead.
Upvotes: 2