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.

posta 2 anni fa465 visualizzazioni
2 Risposte
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
TECNICO DI SUPPORTO
Ryan_A
con risposta 2 anni fa
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
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande