Hi,
I was able to move folders in OneDrive with Power Automate, and currently I am trying to automatically delete those folders older than a month,
I have tried to
1) Set up recurrence,
1)I inserted a "Show files in the folder", selecting folder A.
2) For each -> Body/value
3) Conditional -> Last modified is less than addDays(utcNow(),-7)
4)True -> Delete Files -> id
I also read to use:
1. "Delete file" action does not work for folders; use "Delete folder" instead.
2. Ensure IsFolder is checked to delete only folders, not files.
3. Compare LastModified with addDays(utcNow(), -7) correctly.
Below is fixed flow with correct expressions and conditions
1. Trigger: Recurrence (e.g., Daily)
2. Action: "List folder" (Folder A)
3. Apply to each: Body/value
Condition 1: Check if item is a folder
Expression: item()?['IsFolder']
If true, proceed.
Condition 2: Check if older than 7 days
Expression: item()?['LastModified'] is less than
Value: addDays(utcNow(), -7, 'yyyy-MM-ddTHH:mm:ssZ')
4. If True: "Delete folder" → Id
But I am afraid the last one is not suitable for OneDrive...
¿Could you help me?
Thanks