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 / Auto delete flow is de...
Power Automate
Unanswered

Auto delete flow is deleting from subfolders when marked as FALSE

(0) ShareShare
ReportReport
Posted on by 4

I'd love some help as to why my flow is deleting files in a subfolder when it is marked as NO/FALSE in the flow. Any clues? 

 

Design123_0-1674578532394.png

 

Screenshot 2023-01-24 at 08.41.49.png
Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,081 on at

    It means your condition always returns Yes.

  • Design123 Profile Picture
    4 on at

    But why is it even looking in the subfolder in the first place? 

  • grantjenkins Profile Picture
    11,063 Moderator on at

    The issue is that List files in folder returns both files and folders that are contained in that folder - so when you loop over the results, you're deleting both files and folders at the top-level which would effectively delete everything in the folders you deleted.

     

    When you use Get files and Get items in SharePoint, they also return both files/items and folders.

     

    To resolve your issue, there is a property that's also returned for each item called IsFolder which is set to true or false depending on whether it's a folder or file. You can check this property, and only delete the item if IsFolder is false.

     

    grantjenkins_0-1674612375396.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard