Hello,
I am a beginner at Power Automate. I created a scheduled export from Power BI to a CSV file that includes a date/time stamp in the name. I'd like to be able to delete files that are 7 days old so this folder doesn't grow out of control. Thank you for any help you can give!
Jim
Solved! Go to Solution.
@ScottShearer Thank you so much. That worked! I greatly appreciate your help and taking the time to share your talents!
See my example below. Not the filter query and the single quotes around the expression - they are required. The expression that I used can be seen in the action note.
@ScottShearer I'm having trouble figuring out the filter query. Could you explain that a little more, please?
Is it possible to have this look for files in my OneDrive or Local folder instead?
See below for a Flow that will delete files more than 7 days old from OneDrive. OneDrive does not provide the created date so I'm using last modified date. If the files are static, the create and modified dates should be the same.
I think I have everything correct but received this error. Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'addDays' expects a timestamp as the first parameter, the number of days to add as the second parameter, and an optional format string as the third parameter. The function was invoked with '0' parameter(s). Please see https://aka.ms/logicexpressions#adddays for usage details.'.
List of files in the folder I am targeting.
The error is telling you that it doesn't like the addDays() expression.
Take a look at the screen shot that I posted above. In the condition, I placed the expression that you need to use in the notes area at the top of the condition for documentation purposes. It needs to be entered in total in the expression window.
ALSO, CHANGE THE -1 IN THE EXPRESSION TO A -7. OTHERWISE YOU WILL DELETE FILES OLDER THAN 1 DAY.
In addition, change the condition from "equal to" to less than or equal to
@ScottShearer Thank you so much. That worked! I greatly appreciate your help and taking the time to share your talents!