How to check empty folder

How to check empty folder in UiPath.
Any activity available for checking empty folder.

Image available in folder
Select all images
If folder is empty
Select asset images.

How to check folder is empty or not using UiPath activity.

@Harish_Ghadage

you can use this expression in an assign activity if the folder is empty it returns false and if it has any data it returns true

system.io.Directory.EnumerateFileSystemEntries("path to folder").any()

using this variable you can get images from asset or the folder

image

Hi @Harish_Ghadage

Try this:

If 
  Directory.GetFiles("yourfolderPath").Length = 0 
Then
 'Folder is empty
Else
 'Folder is not empty
End If

Regards

1. Using Directory.EnumerateFiles

bool isEmpty = !Directory.EnumerateFiles(path).Any();

if (isEmpty)
{
  Console.WriteLine("The folder is empty.");
}

2. Using Directory.GetFiles

int fileCount = Directory.GetFiles(path, "*", SearchOption.TopDirectoryOnly).Length;

if (fileCount == 0)
{
  Console.WriteLine("The folder is empty.");
}