Check if the folder has a files

Good day,
I need to check if the folder has a files if theirs a file the program will continue the process unless if the folder is no files the program will show message box “no files found”

thank you for your concern,


  1. Use below command to get files in that directory and assign output to string array.

         Directory.GetFiles("Ur folder path") 
  2. check the length of the array. If length is greater than zero, then files exists in folder otherwise files not exists in folder.

1 Like

Also Directory.enumareteFiles and check Ienum lenght.

1 Like

thanks it works, :heart_eyes:

1 Like