Check If folder is empty

How can I determine if a specific folder is empty or not, and based on that information, decide on the appropriate next steps to take

@Gaurav_Gore
use this expression it will return True if folder is not empty will return False if the folder is empty

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

@Gaurav_Gore

if:Directory.GetFiles("C:\Users\rlgandu\Documents\Airlines").Count>0
Then

Hi @Gaurav_Gore

You can use the below expression in If condition,

- Condition -> System.IO.Path.GetFile("Folder path").Select(Function(x) x).Count<1

The bot will execute then block if no files found in the folder.
The bot will execute else block a single file found in folder.

Hope it helps!!

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