AWS WorkDocs - File Count

0

Is there any way to count how many documents are in a WorkDocs folder? I have tried multiple ways and have done some research, but still can't figure it out. My challenge is that it's hard to tell whether there were any issues in a bulk upload from a desktop folder. . It seems the only way is to count lines using the scroll. Can you please let me know if there is an easy way to show the count of the files in the folder.

已提問 2 年前檢視次數 465 次
2 個答案
0

Hi,

Thanks for reaching out. I was able to count the number of items in a workdocs folder by using a combination of the AWS CLI and jq.

For the CLI, I used the describe-folder-contents API command which describes the items under a certain Workdocs folder. Please see the documentation of this command here. This command describes the items found under a certain folder. I have found that the easiest way to get the folder id is to navigate to the folder in workdocs and get it from the URL -> e.g. https://[WORKDOCS_UNIQUE_NAME]/workdocs/index.html#/folder/[folder-id]

We can see the documentation of jq here in this page. Please check it out if you have not used jq before.

Please see below for an example command that we can use:

aws workdocs describe-folder-contents --folder-id [FOLDER_ID] --type ALL --sort DATE --order ASCENDING | jq '.Documents | length'

For this command we are using the describe-folder-contents API to describe the contents of the folder. This returns a JSON object with a key called "Documents" which contains an array of the descriptions of the documents under this folder. We are using jq here to count the number of members of Documents array

I recommend running the above command without the jq part first so that you see the actual JSON output. One thing to note here is that this is a paginated operation. Please take note if there is a Next Token returned as you will have to keep calling this API until all the results have been returned. If you have a lot of items it may be better to create a script in a programming language such as Python rather then using the AWS CLI.

With the above command, I am able to count the number of items in my folder. Please let me know if you have any questions.

AWS
支援工程師
Ryan_A
已回答 2 年前
0

I found another solution to this that requires you to have the companion app downloaded.

  1. go to your file folder and navigate to your Workdocs network folder.
  2. in the search bar, type "kind:=folder" or "kind:=document", or whatever you'd like to know the number of
  3. once that loads, click Ctrl + a to select all.
  4. holding the Shift key, hover over your selection and right click. select copy as file path
  5. go to excel, and paste the file paths in! for some reason, I couldnt use Ctrl P for this, i had to click the paste icon in excel.
  6. you then can convert text to table using \ as a deliminator if you'd like to separate the file path from the file name or leave as is!
  7. click column A to see the file count

bit of a roundabout solution, but it worked for me! the benefit of this method is it pulls everything, even if its many sub-layers deep :)

Olivia
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南