How to use condition for if-else activity

I have a scenario where I need to open a particular directory and fetch a file. Now after opening the directory if the file is present there, then I need to press open button. Else, I need to press the close button. So can anyone please explain to me what should I type in the condition block of if-else statement.

you can use the below expression in the IF condition to check whether the file exists or not before opening the directory -



Files = Directory.getFiles(“DirectoryPath”)
Then check Files.count > 0 or not