Skip to main content

Notifications

Power Platform Community / Forums / Using Flows / Using Power Automate f...
Using Flows
Answered

Using Power Automate flow to delete all files and folders inside a sharepoint folder

Posted on by 11

Hi all,

I've followed the steps in there to automate file deletion based on the creation dates.

Delete files from a sharepoint folder - Power Platform Community (microsoft.com)

However, folders are not getting deleted, If I dump all the files in one folder, and rerun the flow, all files get deleted without any issues.

That is the error "TobeDeleted/24-001 does not exist" I get which relates to one of the folders inside the main folder.

Any suggestions are welcome.

 

Thank you.

 

  • CU03091917-0 Profile Picture
    CU03091917-0 26 on at
    Using Power Automate flow to delete all files and folders inside a sharepoint folder
    Still fails
     
    You have to delete all the items in this folder before you can delete the folder.
    clientRequestId: c03de77e-a9da-427d-806e-
    serviceRequestId: 21bb4ca1-f065-6000-6667-
  • Verified answer
    jebz Profile Picture
    jebz 11 on at
    Re: Using Power Automate flow to delete all files and folders inside a sharepoint folder

    That worked perfectly, thank you so much.

  • Verified answer
    v-jefferni Profile Picture
    v-jefferni on at
    Re: Using Power Automate flow to delete all files and folders inside a sharepoint folder

    Hi @jebz ,

     

    To delete all contents from a folder, you can use the Delete item action. It's not supported to delete folders using Delete file action.

    vjefferni_0-1710234090592.png

     

    In Delete item action, you need to retrieve list name from Peek code in Get files action, copy table id and paste in the List name field in Delete item action:

    vjefferni_1-1710234443708.png

    vjefferni_2-1710234502021.png

    vjefferni_4-1710234565177.png

     

    Note that in Get file action, Include Nested Items needs to be false and in Delete file action it needs to use ID instead of Identifier.

     

    Best regards,

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,191

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,419

Leaderboard

Featured topics

Restore a deleted flow