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




  • 正式なコメント
    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

    コメントアクション パーマリンク
  • jnickell


      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.

    コメントアクション パーマリンク
  • 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
    コメントアクション パーマリンク