Check number of files in the folder with the count of days in the current month

Hello,

My task is to verify if in the given folder there is expected number of files. Every day 3 files is created. For example for current month 29*3 files is expected in the folder.

I am able to get count of the days for the current month by DateTime.DaysInMonth(2024,2), but I have to “hardcode” the month in the mentioned code manualy.

Could somebody advise me, how to get the count of the days in the current month automatically please? I have only few experience in coding yet.

Thank you in advance.

Peter

Hi,

Can you try the following?

DateTime.DaysInMonth(Now.Year,Now.Month)

image

Regards,

Hi @Pmm

You can use the below expression,

- Assign -> DaysInMonth = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)

→ DaysInMonth function will get the days in a month
→ DateTime.Now.Year will get the present year
→ DateTime.Now.Month will get the present month.

Check the below workflow image for better understanding,

Hope it helps!!

That is it! Thank you both @Yoichi @mkankatala ,

@mkankatala I got the point, thanks for the comment.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.