Get Specific File Data from Folders,Subfolders

file

#1

I am trying to extract data from file/s which contains a specific word “MemberRef”

These files are present in subfolders of main folder like

\user1\Documents\2016\Jan\MemberRef12.xlsx
\user1\Documents\2016\Feb\MemberRef21.xlsx
\user1\Documents\2016\Jun\MemberRef22.xlsx
etc

Is there a way where I can search a specific string “Member Ref” in a directory “\user1\Documents\2016” and search the root folders to get the list of all file names and extract data?


How to get the count of number of files and folders present in a main folder
#2

Hi,

You can use Directory.EnumerateFiles - example attached.
Command in your case would be similar to:
Directory.EnumerateFiles("\user1\Documents\2016", "*MemberRef*.xlsx", SearchOption.AllDirectories)

FindFilesTest.xaml (6.1 KB)

Regards,
Andrzej


How to set task in UIPath? need help
#3

Thanks Andrzej,

I have used another line of code which yields similar results.

“Directory.GetFiles(”\user1\Documents\2016,“MemberRef.xlsx”,SearchOption.Alldirectories)"

Many Thanks! :slight_smile:


closed #4