I am building a flow that must delete files from a SharePoint Shared Document Library which either are older than 30 days or match the filename of in the format "eBayITLabel_6507-00005_20190117_15_58.pdf"
The part of the filename that we would match would be 6507-00005 and that would be unique (the last 5 digits "00005" would increment one by one up to 99999...
Essentially we have that number in a sharepoint list, and every week we would run the flow, filter for the records in the list where status = certain values, and loop through those items, deleting all the files found that match the current string
so how do I search for files in the SharePoint Library using wildcards in the name like that?
I don't have any issues removing files older than 30 days, but would prefer to actually remove the files based on the name
thanks
Solved! Go to Solution.
Hi @livingstonep,
For example, configure Identifier of the filtered files in Delete file action.
Image reference:
Best Regards,
Hi @livingstonep,
Currently, MS Flow does not support the use of wildcards and regular expressions.
Could you share more details about your Flow configuration?
Since you mentioned that these numbers are stored in the list, you could traverse the list with "Get items-Apply to each".
Then check if the file name contains the number contained in the current item.
If yes, delete the file.
Please take a try to configure your flow.
And if it doesn't work for you, please provide more details about your needs, we would provide proper workaround for you.
Best Regards,
Hi,
Thanks for your help.
But the Delete method in SharePoint requires a File Identifier - how can we get that please?
Hi @livingstonep,
Could you share a screenshot of your current Flow configuration?
I speculate that your Flow may contain Get files(properties only) action.
You could configure the Identifier it outputs in File Identifier field.
Best Regards,
Hi,
yes we are using Get files(properties only) action
so how do we get the File Identifier that we need to plug into the SharePoint - Delete file action?
We want to delete these files from a SharePoint Shared Document Library
Hi @livingstonep,
For example, configure Identifier of the filtered files in Delete file action.
Image reference:
Best Regards,
Hello,
I am attempting to create this flow that allows me to delete all files sitting in a sharepoint folder after X number of days.
However it failed.
Would you be able to advice what went wrong?
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression 'v@{body('Get_files_(properties_only)')?['value']}' is of type 'String'. The result must be a valid array.
User | Count |
---|---|
89 | |
37 | |
26 | |
13 | |
12 |
User | Count |
---|---|
128 | |
53 | |
38 | |
26 | |
21 |