
Announcements
Hi,
I'm trying to build a flow that helps to download individual file from many subfolders.
My pain/situation currently is that the old system creates subfolders of individual results daily, and I need to manually extract the data from the final file from each subfolders
Below are the example of folders & name. Hopefully explainable.
20240201(date) > subFolder1 > subFolder1.1 > subFolder1.1.1(onwards from 1.1.1 to 1.1.60) > file.A
20240202(date) > subFolder1 > subFolder1.1 > subFolder1.1.1(onwards from 1.1.1 to 1.1.60) > file.A
So, the variable i have is everyday the main folder will have a new name, and sub folders 1.1.1 up till 1.1.60
the fixed is subFolder1, subFolder1.1, and the end file name file.A. so inside each subfolders 1.1.1 up till 1.1.60 will have file.A each which i will have to manually extract 60 files daily.
I've done approval flow, triggering flow. But this problem i have above is quite hard to handle for my level of expertise.
For now, i can manually trigger to 1 file, but is there anyway to create a manual trigger flow path (changing the main folder name daily in the Flow variable) to 60 subfolders and download all 60 files.
all helps, guides, and suggestion are welcomed!
Thank you.
Hi @OtisZZZ,
You are missing a key element in your question which is the data storage architecture.
Assuming you have a SharePoint Document library with the structure you described you can use the Get Files (properties only) action to only fetch a filtered subset of the files in that library and iterate the results to copy/download/performs other actions.
There are 2 ways to filter the items, query all of them and filter using a Filter Array action or to pass a OData Query filter to the Get Files (properties only) action. I prefer the 2nd as it's more efficient but it depends on the actual size of your library.
The process requires setting the Get items (properties only) action Pagination property to on (under settings) and set the Threshold to 5000.
Next if you want to use a Filter Array action, add one and set its From: to value and the filter to Folder Path contains "subFolder1/subFolder1.1/subFolder1.1"
If you opt to use the filtered query on the 1st step you can do something like:
the expression should say: