How to read doc and zip files in a directory using Getfiles

Hi All,

I am looking to read doc and zip files a directory using GetFiles. Directory.GetFiles(“C:”,".zip,.doc*"). However, this command reads only zip files. Please let me know how I can read both doc and zip files .

Regards

Hi
welcome back to uipath community
we need to use two different expressions as directory.getfiles will take only one argument for file extension
so the expression be likethis
Directory.GetFiles(“yourfolderpath”,"*.zip")
Directory.GetFiles(“yourfolderpath”,"*.doc")

Hello @reshma_mohiyiddin
You can do it n a single code to get multiple extensions files. use Directory.GetFiles("your folder path","*.*", SearchOption.AllDirectories).Where(Function(j) j.EndsWith(".doc") Or j.EndsWith(".zip")).ToArray. you will get all the files with doc and zip Extensions.
Regards

2 Likes