Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Connectors
Unanswered

How to create a flow to delete files in SharePoint

(0) ShareShare
ReportReport
Posted on by 21

Hello,

 

I'm looking to create a flow which would automatically delete files from a folder in a SharePoint library.

I would like to delete all files older than 7 days that are in a specific folder in my library with this rule.

 

Could you guide me through creating this flow?

Thanks. Baptiste.

 

 

  • sickaroll Profile Picture
    5 on at
    Re: How to create a flow to delete files in SharePoint

    Thanks for this, I was building relative file paths with concat() and getting nowhere, in spite of matching strings precisely with the 'browsed for' path (which doesn't show the /s as escaped, oddly). 
    Identifier works very well and is much neater. 

  • MrNPP Profile Picture
    8 on at
    Re: How to create a flow to delete files in SharePoint

    Hi there,
    I was stuck on this too, with the last step saying the file did not exist.
    You need to edit the last step to use the dynamic content "Identifier" not "ID".

  • Baptiste_k97 Profile Picture
    21 on at
    Re: How to create a flow to delete files in SharePoint

    Hello, My problem is still relevant. Thanks

  • Baptiste_k97 Profile Picture
    21 on at
    Re: How to create a flow to delete files in SharePoint

    As much for me @Mira_Ghaly  ...

    Now I have an error at the last step of the flow : the files to be deleted are not found.

    Baptiste_k97_0-1621355845205.png

     

    I am told that the file to delete does not exist. 

    I have the error message : "The file '/sites/WebsiteName/123' does not exist".

    The last step of the flow doesn't take into account the folders between the site root and the file to be deleted.

  • Mira Ghaly Profile Picture
    11,409 Super User 2025 Season 1 on at
    Re: How to create a flow to delete files in SharePoint

    It is not

    It it is LT

  • Baptiste_k97 Profile Picture
    21 on at
    Re: How to create a flow to delete files in SharePoint

    Hello @Mira_Ghaly 

    I tried all the possibilities with the french name of my SharePoint column :

    • Créé + it + '...'
    • Modifié + it + '...'
    • Créé + '...'
    • Modifié + '...'

     

    I still have this same error telling me that the "query filter" is invalid.

    Baptiste_k97_0-1621262264253.png

     

  • Mira Ghaly Profile Picture
    11,409 Super User 2025 Season 1 on at
    Re: How to create a flow to delete files in SharePoint

    @Baptiste_k97

    Please use

    Fieldnameinfrench lt

     

    lt for less than

  • Baptiste_k97 Profile Picture
    21 on at
    Re: How to create a flow to delete files in SharePoint

    @Mira_GhalyI still have the same error.

    In "Filter query" I put the following expression :

     

    Cree it 'format...'

    formatDateTime(body('Obtenir_l''heure_passée'),'yyy-MM-dd')

     

    Baptiste_k97_0-1621234269986.png

     

  • Mira Ghaly Profile Picture
    11,409 Super User 2025 Season 1 on at
    Re: How to create a flow to delete files in SharePoint

    @Baptiste_k97 

    it is missing the Cree lt 'format...'

     

     

  • Baptiste_k97 Profile Picture
    21 on at
    Re: How to create a flow to delete files in SharePoint

    Hello,

    I tried with the French name of my column but the result remains the same.

    Baptiste_k97_0-1621181221360.png

     

    Here is the column in question:

    Baptiste_k97_1-1621181298887.png

     

    Details of the error :

    Baptiste_k97_2-1621181387329.png

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492

Featured topics