Hi @Harshit ,
Thank you for posting in this community.
Since Power Automate is currently not supported in the Q&A forum, and my knowledge of it is limited, below is a workaround based on my knowledge, if this solves your problem that would be great. If this does not solve your problem, or if you are experiencing a more complex issue, it is recommended that you start a new discussion via the Power Automate Community to get more targeted support.
If you want to delete a file based on its created date but keep files received on month end using condition, you can refer to the following screenshots.
Flow in details:
1.Add a "Get files (properties only)" action to retrieve the metadata of the files.
2.Add two conditional expressions to delete a file when its creation time is yesterday and the creation time is not the end of the month.
The Expression on the left of the first Condition:
formatDateTime(item()?['Created'],'yyyy-MM-dd')
The Expression on the right of the first Condition:
addDays(utcNow(),1,'yyyy-MM-dd')
The Expression on the left of the second Condition:
formatDateTime(item()?['Created'],'yyyy-MM-dd')
The Expression on the right of the second Condition:
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)
Hope the information can help you.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.