web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete sharepoint file...
Power Automate
Unanswered

Delete sharepoint files and nested folders

(0) ShareShare
ReportReport
Posted on by 603

Hi all,

 

I try to build a flow that is delete all files AND folders that are nested in the folder named "Temp folder".

To achieve this I try many threats but no one is helping correct. 

When I try to delete all the files inside the folder and the files inside the nested folders, it's give me this error:

The file /sites/ExampleApps/Shared Documents/Temp Folder/test does not exist.
clientRequestId: 36fb3315-41ee-4072-b5f0-e277f1494a45
serviceRequestId: d8f318a0-60ed-3000-9da7-6ee2460df4a4

 Flow printscreen:

dennisb88_0-1642776207692.png

 

The files will be deleted in this scenario, but the nested folders will not, but I want to delete them to.

 

So I try this flow showed in this article: Solved: delete empty folders in sharepoint document librar... - Power Platform Community (microsoft.com)

But that's not working also:

I get an error that says "bad gateway". 

 

dennisb88_1-1642776421504.png

Is there anyone who know how/or what to do to remove all the files and nested folders inside my folder named: "Temp folder"

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @dennisb88,

    Do you want to delete all the files and nested folders within the temp folder?

    Actually you could delete it using the folder metadata and delete all the items within using the ItemId:

    vqiaqimsft_0-1643017305109.png

    Screenshot 2022-01-24 174621.png

     

  • dennisb88 Profile Picture
    603 on at

    Hi @v-qiaqi-msft ,

     

    Thank you for your reply.

     

    I have already tried that one, but it is not working for me.

    The follow error showed up:

    dennisb88_0-1643018982035.png

     

  • rvroman Profile Picture
    29 on at

    I do something similar:

    I delete the files first, using Delete File action and condition that item is not a folder.

    Then I delete the folders, using Delete Item and condition that item is a folder and size is 0.

     

    If you have folders within folders, however, I don't yet have a solution to delete sub-folders before parent folders... If someone has an idea on that, I'm open ears.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard