"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?

Hi,

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

VB.net

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

C#

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

Regards,

Hi @Yoichi

Sorry i’m not familiar with either modes

Hi,

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

Regards,

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.