Anoop M Maddasseri
Anoop M Maddasseri

Reputation: 10529

How can I detect the particular given dropbox path is file or not using android core API?

I want to detect a particular dropbox path is file or not using android core API.how come this possible ? Any help is appreciated.

Upvotes: 0

Views: 143

Answers (1)

Anoop M Maddasseri
Anoop M Maddasseri

Reputation: 10529

I found the snippet

The isDir field on DropboxAPI.Entry tells you if the Entry is a file or folder.

        // Get the metadata for a directory
        Entry dirent = mApi.metadata(mPath, 1000, null, true, null);

        if (!dirent.isDir || dirent.contents == null) {
            // It's not a directory, or there's nothing in it
            mErrorMsg = "File or empty directory";
        }

Also posting Directory create and delete methods available in DropboxAPI

mApi.createFolder(directory_path);
mApi.delete(directory_or_file_path);

Thank you.

Upvotes: 1

Related Questions