Get a list of file directory with the files being in the sub-folders of the known parent folder

Hi All,

I am trying to get a list of file directory from a parent folder - immediately with in this parent folder, there won’t be any actual files, but the files are located within the subfolder (and potentially multiple subfoders) under that parent folder.

The only thing I know is the parent folder address (I do NOT know the names or how many subfolders there are going to be), how can I get a list of all files under the parent folder?

Thanks in advance for your help!


Hi - I’ve tried that but my array comes back as null because there is no files directly in the parent folder, they are all in the subfolders under the parent folder.


My Apologies. I understand your requirements now.

Use Directory.GetDirectories(parentFolderName)

1 Like


Hi - thanks so much for replying. Just tried this method - but it only gives me the next level of the folders (C:\parent folder\subfolder) while I need the actual file name (C:\parent folder\subfolder\file.pdf)

Possibly there will be multiple subfolders under the parent folder (C:\parent folder\subfolder1\subfolder2\subfolder3\file.pdf) - how can I get a list of all files knowing only <C:\parent folder> ?

I know I can probably use a loop inside of a loop inside of a loop, but is there a more direct and efficient way?



I would use a loop system you just described. If there is a more direct and efficient way, I would also love to know for my personal knowledge!

Best of luck!


@ianhyj , I would like to help on this subject.

You need to perform a recursive check. I haven’t created something like this on UI Path yet. But , i would start selecting the main folder/target folder using the “Select Folder” activity. After that you you need check if there’s more directories inside the folder and extract the list of the folders Directory.GetDirectories(selectedfolder"(YOUR Varible, output of Select Folder Activity)").Return all file from your main folder and check each subfolder change in/out parameters. Remember , you need to combine FlowChart with Sequence in order to do a recursive search and loop through all Folder and extract all files.

Hope i could help you with the way you should take to solve this.

1 Like


I also found an additional package on the UiPath GO! website. Not sure if it helps you or not.



Brad - you are the man! This is exactly what I am looking for. Appreciate your help!


check out this -


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