I was asking myself if its possible to delete a SharePoint folder using MS Flow. I mean when time passes delete automatically a folder. Thanks!!
You can create a flow to delete folders on a given condition, bare in mind as of today, flow does not have an action to delete folders, just files/documents. You should perform an HTTP request to the SharePoint REST API and delete the folder.
What you can't make is to run a flow like an on-premise timer job. If you are looking for automatic deletions, you should check for retention policies and, sometimes, create an Azure Webjob to perform this kind of recursive actions.
You don't have to use HTTP Request to delete the folder. You could try this easier option to delete the folder just via the default "Delete Item" action.
You need to use the get folder metadata action to get the folder Id, then when you use the delete item action select the site address, enter the library name as a custom value, and then select the ItemId option from the Get Folder.
What license are you using and are you a global admin? If so you might want to automate the deletion of transitory or temporary content on an org-wide or tenant level. You can do with with the security and compliance tools in M/O365 E3 and E5 licenses, and also in Exchange for email using retention policies (that also include disposal). Creating a Flow will do so from your user name.
So, part of this question seemed to be about asking how to do this based on a date (time passing). I found I could do this with Flow -- if I set up a date for it to check from the library. I couldn't get it to calculate based on a built-in date (like "created") within the flow itself (and not saying it can't be done -- I just got errors with everything I tried), but I was able to tell it to do it based on the date field it checked being older than today (utcNow).
In SharePoint, I set up a retention policy for the library (our need is that each library in this specific site may have different "expiration" dates, so we're doing the policy at the library level) -- to move files to the recycle bin 21 days after the file was created. For this site, the created date is the same as the upload date. Because it's SharePoint Online, the retention policy runs once every 7 days (or so I've read). So, if I really want it to delete at 21 days (and not up to 6 days later when it does its once weekly processing), I want to use a Flow to do it.
Here's the flow I cobbled together. Note -- this is for the files, specifically, in one library. I noticed someone above shared a flow to do folders. I haven't yet tested/incorporated that into my flow. But I do show how you can get a flow to run regularly, check a date, and delete anything that matches that condition (i.e., older than that date).