Showing results for 
Search instead for 
Did you mean: 
New Member

Delete files in batches in a OneDrive for Business folder

I would like to delete all files in a particular OneDrive for Business folder. I cannot do it normally because the number of files there is larger than some hidden limit and I am getting error 36. I can delete them one by one or in small batches that this will take forever. So, I would like to try a flow that would delete all those files for me one by one or in reasonably batches (100 at a time?), possibly waiting between deletions not to overwhelm the system. I suspect that listing all files in one go would also result in errors, so maybe the actions should be:


  1. List first 100 files in the given directory.
  2. Delete these files.
  3. Wait till completed.
  4. Repeat.
  5. Report when no files are found.

I am completely new to Flow so would really appreciate a recipe.


Thank you.

New Member

Re: Delete files in batches in a OneDrive for Business folder

Here is my naive go. This fails with Bad Gateway message, status code 504. Maybe because of too many files for the search?






Community Support
Community Support

Re: Delete files in batches in a OneDrive for Business folder

Hi @___,


Could you please share the screenshot and more details about the error message when the flow run failed?


Best regards,


Helpful resources


Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,831)