Check if files are in folder

Hello all,

I would need to use an IF activity for this. I need to check whether there are any files in a certain folder.
If there are files, then run the process, else nothing.

What activities and what condition would I write for IF to meet the above conditions?

1 Like

You can use the below condition in an IF activity.

Directory.GetFiles(FolderPath, “.”, SearchOption.AllDirectories).Count > 0

“.” - Looks for all the file extensions. You can specify file entensions like “.pdf”

SearchOption.AllDirectories - Looks for all the Subfolders within the folder you have mentioned. If you need to look only in the root folder, it can be removed.

Happy Coding!! :slight_smile:


You can use the Path Exists acivity if you want to check if it has a file or not @dvn

cheers :smiley:

Happy learning :smiley:

1 Like

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