Check if Folder Path Exists with Unknown Folder Name

Hi everyone! Is there an efficient way to loop through different folders with a wildcard to find a specific file path for each row in a datatable? The goal is to see if a folder path exists and, if so, write this folder path into the datatable.

This is the scenario:
Folder1/Date/Folder2/FileName.xlsx

where Folder1 and Folder2 are known variables (which I get from each datatable row) but Date is not known.

Hi @sidb ,

Could You Try the Below Expression to retrieve all the Matching file paths :

Directory.GetFiles("Folder1","*.xlsx",SearchOption.AllDirectories).Where(Function(x)Directory.GetParent(x).Name.Equals("Folder2")).ToArray

Let us know if this doesn’t work.

Hello @sidb ,

Is it allowed powershell integration with uipath in your project? If yes we can do that easily.

Thank you so much! This worked :slight_smile:

1 Like

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