新しいBoxサポートサイトへようこそ。 変更点の詳細はこちらをご確認ください .

Folder info - number of files

新規投稿

コメント

4件のコメント

  • Bibek

    Hi ,

    Yes, you are right. There is no direct reference to folder or file numbers from that API call. But there is indirect way of gettng it. You have to call folder info api and it will show you the 'item_collection' array where you can get 'total_count' of items. However you have to loop through that array to count the folder or file by using the "type" field.

     

    eg.

    "item_collection": {
    "total_count": 2,
    "entries": [
    {
    "type": "folder",
    "id": "xxxxxx",
    "sequence_id": "2",
    "etag": "2",
    "name": "Tyrion Lannister"
    },
    {
    "type": "file",
    "id": "xxxxxx",
    "sequence_id": "1",
    "etag": "1",
    "name": "No one.pdf"
    }]

     

    As you can see in above e.g. the total_count is 2 with 1 folder and 1 file. But this will only work for the single folder. You have to create your own recrusive function to go through all the folders in depth.

     

    hope this helps.

    Bibek

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

    Thanks @Bibek!  Yes, I think makes sense.  

     

    My interest in the number was actually to write a test for a different program that itself recursively loops through directories and files to create and update a database of file names and their sha1's.  I was doing that to be able to check for a given file (if I have its sha1) whether that file already exists on Box.

     

    Anway, I'm sure I can make due with what's available.

     

    Best regards,

       Mike

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

    Hi ,

    Sure, you can make it happen 🙂 Good luck.

     

    thanks,

    Bibek

     

     

    0
    コメントアクション パーマリンク
  • Ori Gottlieb

    this is not helpful.  I would like to be able to see a file count for every folder in my box directory.  not possible?  seems like a very basic feature

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

投稿コメントは受け付けていません。