@buro2020 The Get Files (properties only) action returns files and folders. In this YT Short I show how to use a Filter Query to return files only.
In your case, since you want to return folders only, set the number to 1. Before you even add the Send an email action to your flow, I would recommend building and testing it out first.
Get Files (properties only) – Return Folders
Add a filter query to your action and include a Compose action below to count the number of folders returned.

Run a test to confirm the number of items returned.
You shouldn't need the Get folder metadata action as the Get files (properties only) action will return the metadata. Take a look at the outputs.
Create a Dynamic Date
I would recommend using a few actions to create a dynamic date which you can use to check against the Folder Name (eg. 230901 Test folder). The Scope action is optional, however I find it can come in handy if you need to quickly copy these actions to use in different flows.

Add a Convert time zone action to convert the current time to your local time zone. In the Base time field, insert the utcNow() function. Select (UTC) Coordinated Universal Time as the Source Time Zone. For the Destination Time Zone, you can select your local time zone. For the Format String select Round-Trip

Next add a Compose action to store the number of days you'd like to add/remove from the current date. A positive number will add days, a negative number will subtract days. In your case, enter -7. This Compose action is optional as this number can be entered directly into the addDays() function if you prefer.
However, by using a Compose action to store the number of days to add/remove you can easily alter this expression by editing the Compose action with the number of days.

Add another Compose action to store today's date. This is optional, but it can help with troubleshooting and it also allows you to format today's date to be used elsewhere in your flow.
Use an expression and insert the Converted time dynamic content from the Convert Time Zone Action.
formatDateTime(body('Convert_time_zone'), 'yyyy-MM-dd')
Add one more Compose action to store the dynamic date. This will be the date that was 7 days ago. You'll need another expression. Use the addDays() function. It takes 3 parameters.
addDays([date to add/remove days from], [number of days to add/remove], [date format] )
I've used the dynamic content from the Compose actions above in my expression. This is what my expression looks like:
addDays(outputs('Compose_-_Today''s_Month_and_Day'), outputs('Compose_-_Days_to_Add_or_Remove'), 'yyMMdd')Important: The date format should match the date format in your folder name.

Run a test to confirm the outputs of the the Compose action above.
My output looks like this.

Filter Array
Add a Filter Array action to your flow. You'll use this action to check for any folders that start with the dynamic date stored in the Compose action above.
In the From field, insert the value dynamic content from the Get Items action.

In the first value field insert the Name dynamic content from the Get Items action. Change the operator to starts with and in the second value field insert the outputs from the Compose action that is storing the dynamic date.

Compose Filtered Count
Add a Compose action to store the number of folders returned. This Compose action is optional however, it does help when it comes to troubleshooting and you can also use the number returned in a condition action.
Insert an expression and use the length() function to store the body dynamic content from the Filter Array action.

Hope this helps!
If I helped you solve your problem—please mark my post as a solution ✅. Consider giving me a 👍 if you liked my response!
|