Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

List all files inside box folder

New post

Comments

2 comments

  • Murtza

     The sample code you provided should return the items in a folder, which will include both folders and files.

     

    The example below from our Java SDK documentation shows how get all folder items, and then check if each item returned is a file or folder. 

     

    BoxFolder folder = new BoxFolder(api, "id");
    for (BoxItem.Info itemInfo : folder) {
        if (itemInfo instanceof BoxFile.Info) {
            BoxFile.Info fileInfo = (BoxFile.Info) itemInfo;
            // Do something with the file.
        } else if (itemInfo instanceof BoxFolder.Info) {
            BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo;
            // Do something with the folder.
        }
    }
    0
    Comment actions Permalink
  • pcapdown

    Is this this only method to get the meta data (name, size, etc) of all the files in a folder?

    I ask because I am using it to traverse a few directories and it is VERY slow.

    Is there perhaps a single "ls" (unix cmd)  equivalent that is faster than having to enumerate each FileInfo?

    0
    Comment actions Permalink

Please sign in to leave a comment.