IF activity condition: If there is only 1 file in folder

I am trying to write a condition to check whether there is only one file in a folder or not.

i tried using Directory.GetFiles(foldersource, “.xlsx”, SearchOption.AllDirectories).Count <> 1 but it wasn’t accurate.

How can I make such a condition?

Hi @dvn,

Pls try this solution.Let me know if you have any issues.

Directory.GetFiles(“foldersource”,“*.xlsx”,SearchOption.AllDirectories).Length<>1

[c# - Check if folder contains files with certain extensions - Stack Overflow]

Regards,
Omkar P