Welcome to the new Box Support website. Check out all the details here on what’s changed.

Getting all files in a folder (with recursion) via Box CLI

Completed
New post

Comments

4 comments

  • Official comment
    Alex Novotny

    Hey John!

    When you say you are getting results, are you running a command like this:

    box search "blank" --type=file --ancestor-folder-ids=<folder_id> --mdfilter=enterprise.<template_key>.<field>=<value>

    To see the next group of results, I would refer to our pagination documentation here

    In general, I would not recommend using the search APIs to recursively go through a folder's content. I don't know your full use case, but I would probably write a powershell script that contains some recursive logic using the get folder items endpoint

    Alex, Box Developer Advocate

    Comment actions Permalink
  • jnickell

    Alex,

      Thanks for the response. I abandoned the recursive search technique because it took a long time to get what I was after. Unfortunately I'm not seeing a way within the Box API interface to accomplish what I was after.  

    The recursion was being controlled via the powershell script and even using the get Folder items it was pretty intensive.  
    My goal was simply to list the total # of files in a folder including subfolders. Sadly for the level of accuracy that I need, just opening up the page in the Box web app gives me the information much more quickly.  

    Ideally I'd be able to get these files and provide our user base the count of files by type (i.e. photos, drawings, pdfs etc)

    Thanks again for responding, and if you can promote a recursive api endpoint that could help.

    0
    Comment actions Permalink
  • Alex Novotny

    Ah. I appreciate you letting me know. You might check our Pulse site for this. If it exists, upvote it. The product team watches that site for what to put on the roadmap. 

    0
    Comment actions Permalink

Please sign in to leave a comment.