How to check if folder has files or no files

I have one string var as hdfc i used assign to give path as Environment.ExpandEnvironmentVariables(“%USERPROFILE%\Downloads\HDFC”) also I already have folder as hdfc inside it sometimes I have file and sometimes wont.

so how to check if my folder contains files or no files.

@Sathish_Kumar5

check the thread

@Sathish_Kumar5

gives boolean value

directory.getfiles("Yourfolderpath").count>0 

@Sathish_Kumar5 ,
Check out this workflow to get the files from folder and sub folders too

Check for Files in Folder and Sub Folders.xaml (11.2 KB)

Cheers,
Mounika

1 Like

Hey @Sathish_Kumar5

Directory.GetFiles("InputFolderPath","*.txt").Count>0

Note: You can use above mentioned LinQ in If Activity directly, Output will be Boolean i.e, True Or False

In the above LinQ:
*.txt = Denotes the file extension, If you have any kind of specific file format then above query will be usefull, it will count only those files in the specified folder!

Regards,
Ajay Mishra

1 Like

Thank you so much it worked!

thanks for the advice

1 Like

thanks for the workflow

thanks for the info!

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