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 / Listing files in a fol...
Power Automate
Suggested Answer

Listing files in a folder prior to deletion

(1) ShareShare
ReportReport
Posted on by 4
So I've created a flow to delete files that have not been modified in the last 90 days, but i wondered how i could add to this a notification of which files will be deleted the next day. I've messed with the notification option in teams and that works well but ideally I'd like it to be something along the lines of
 
"the following files will be deleted tomorrow as they have not been modified in the last 90 days
 
File 1
File 2
File 3"
 
how could I go about creating this?
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    15,116 Super User 2026 Season 1 on at
    You can do something like this:

    The above will return:
  • David_MA Profile Picture
    15,116 Super User 2026 Season 1 on at
    For some reason I had trouble adding this to my prior post:
    • If you have too many rows of data, you may want to convert the Select to csv and attach it to the e-mail instead. There is a limit of how many rows will display in an Outlook message.
    • You can obviously use expressions to better format the dates.
    • You can also put the e-mail into HTML mode and then add CSS to better format the table in Outlook.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    HI,
     
    It's a little difficult because you mentioned teams, so I have no ideas if the notification is an email or teams.
     
    But the process is easy enough, and you said you already wrote the code for finding the things to delete, so not sure where the confusion is.
     
    What is the requirements all up for sending notifications.
  • CU27091213-0 Profile Picture
    4 on at
    David_MA thanks so much for your reply, it is insanely helpful and I have managed to produce the table with your instructions.
     
    I'm very new to this so could you advise how I would use an expression to change the date format? I've looked and all I can find is how to do it for a specific date not dates which change. Ideally I'd like the format to be ddmmyy hhmm.
     
    If I wanted to send the list of files that were deleted would I just add the select and table creation to the deletion flow and change the wording on the email that is sent out?
     
    Many thanks
     
     
  • David_MA Profile Picture
    15,116 Super User 2026 Season 1 on at
    You can use the formatDateTime expression to format the date in the format you desire. An example of this would be formatDateTime(triggerOutputs()?['body/Modified'], 'ddMMyyyy hhmm'). This is a good resource for date/time expressions in Power Automate: formatDateTime in Power Automate in 2024 (sharepains.com)

    If you want to send the list as file, replace the Format HTML Table action with Format CSV and in your e-mail use the output of the Format as CSV for the file content and be sure to name the file with a .csv extension.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 241 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 179

#3
Haque Profile Picture

Haque 159

Last 30 days Overall leaderboard