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?
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.
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?
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.