Hi @Weatherman,
I agree with @ScottShearer's thought almost, but there is no way to get the created time of the files in your OneDrive folder within Microsoft Flow currently. We could only get the last modified time of the files in your OneDriver folder within Microsoft Flow currently.
I assume that the files in your OneDrive folder have not been modified after you created them within your OneDrive folder. I have made a test on my side and please take a try with the following workaround:
- Add a Recurrence trigger, Interval set to 1 and Frequency set to Day.
- Add a "List files in folder" action, specify Folder, Include headers field set to Yes.
- Add a "Apply to each" action, input parameter set to output of "List files in folder" action.
- Within "Apply to each" action, add a Condition, click "Edit in advanced mode", type the following formula:
@equals(formatDateTime(addDays(items('Apply_to_each')?['LastModified'], 46), 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))
Note: For testing, I delete a file from my OneDrive folder when it is 46 days old on my side. On your side, you should type the following formula within your Condition box:
@equals(formatDateTime(addDays(items('Apply_to_each')?['LastModified'], 365), 'MM/dd/yyyy'), utcNow('MM/dd/yyyy'))
Within "If/yes" branch of Condition, add a "Delete file" action, File field set to Id dynamic content of the "List files in folder" action.
Image reference:
The flow works successfully as below:
If you modified the files after you created them within your OneDrive folder, I afraid that there is no way to achieve your needs in Microsoft Flow currently.
Best regards,
Kris