"Expression Expected" error when checking empty folder

Hi all,

In the condition bar in the IF activity I have typed:

If(Directory.GetFiles(folderpath).Length == 0 && Directory.GetDirectories(folderpath).Length==0) = true

but I get the error “Expression Expected”. How do I solve this?


Do you use VB.net mode or C# mode?
We need to write it in condition property of If activity, as the following.


Directory.GetFiles(folderpath).Length = 0 AndAlso Directory.GetDirectories(folderpath).Length=0


Directory.GetFiles(folderpath).Length ==0 && Directory.GetDirectories(folderpath).Length==0


Hi @Yoichi

Sorry i’m not familiar with either modes


Can you check right bottom corner as the following image.

If it’s VB, can you try the following expression?

 Directory.GetFiles(folderpath).Length=0 AndAlso Directory.GetDirectories(folderpath).Length=0


Hi. @Yoichi

Its works! Thank you so much!

1 Like

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