Read Multilevel Folders

Hello Everyone,
I want to make a sequence to read file names from a parent folder and write the values to an excel sheet. Files present in the child folders also to be read along with the parent folder files. Can somebody please guide me on how to make the sequence. I also need to write the file type information while reading the file name. Thank you.

If you know recursive functions, best logic for your business case.

hi @skini76

I am new to UI Path with no background in programming. I have just started to learn. Could you please help me with a sample sequence? Thank you .

Hi @rakesh_seeram,

You have to declare a string array variable and inside an assign activity do this code to that variable.

Directory.GetFiles(targetDirectory, “*.txt”, SearchOption.AllDirectories)

This will give you all the files from all the sub directories in side that directory.

1 Like

Please find the attached workflow, run the parent.xaml, check the console for the list of folders and filenames, instead of console you can write this into a excel file. Parent.xaml (8.2 KB)
Child.xaml (7.4 KB)
GetFiles.xaml (6.2 KB)

what is targetDirectory

Hi,

Target directory is my directory path where we need to get the files.