I try to make a flow for Delete files in OneDrive older than 60 day`s with this example.
But for this point:
3-1. Action: Data Operations - Compose ( Inputs = "@div(sub(ticks(utcnow()), ticks(item()?['LastModified'])), 864000000000)" )
i can`t put it in the expression box, it gives a error.
Is there an other example to make a flow for Delete files in OneDrive older than xx day`s?
Solved! Go to Solution.
Hi @frixel ,
Please use Compose output Last modified and Is folder.
Please show the details of your Flow configuration.
Best Regards,
Hi @frixel ,
You can also try to filter the file using formatDateTime() function and addDays() function.
Expression reference:
formatDateTime(item()['LastModified'],'yyyy-MM-dd')
addDays(utcNow(),-10,'yyyy-MM-dd')
Image reference:
Please take a try.
Best Regards,
I believe that "false" in your condition must be entered in the expression window. The screen shot looks like is was entered just as text. Am I correct?
Hi @ScottShearer ,
Thank you for your reminder, but I have tested it and found that using false is still work.
Image reference:
The current item is a file, so the result here is true.
Best Regards,
In both cases (false as text or expression) the flow does not work and the file`s from 3 days ago are not deleted.
Hi @frixel ,
Please use Compose output Last modified and Is folder.
Please show the details of your Flow configuration.
Best Regards,
When i do this al the files wil be deleted
What happened, it should only delete the eligible files according to the conditions you set.
Ahh,sorry. I forget to "update" the addDays(utcNow) expression
Now it works fine.
Can I ask one more question?
If I want to receive 1 mail when files have been deleted, how do I set it?
If I do it like the below, flow sent an email for each deleted file.(it would be even better if flow counts how many files have been deleted.)
Hi @frixel ,
You can initialize an array to store information about the filtered files.
Use Length() function to calculate the number of files, or you could create an HTML table to display file information.
Image reference:
Please take a try.
Best Regards,
Hi @v-bacao-msft @ScottShearer
If i set that files older than 3 day`s must be beleted is delets file`s from 01-05-2019 -02-05-2019 and 03-05-2019
User | Count |
---|---|
6 | |
6 | |
4 | |
3 | |
2 |
User | Count |
---|---|
8 | |
7 | |
4 | |
4 | |
4 |