Find files in a hotfolder structure

We have a scheduled robot running night time. It shall read Excel files from a hotfolder structure where the folder names are associated to different parameters in the process.
The structure looks like this:

  • C:\UiPath\Hotfolder
    – Company1
    — Param1
    — Param2
    – Company2
    — Param1
    — Param2

The structure is longer than shown above, that is why I would like to avoid to loop through all directories. It would be much easier when I could get a list off all files matching “*.xlsx” with complete path in ALL sub directories to "c:\UiPath\Hotfolder". Than I can process the list and read all files one by one, with the required parameters.

I tried with foundFiles = Directory.GetFiles(“C:\UiPath\Hotfolder*”, “*.xlsx”), but unfortunatelly that method does not support wildcards in directory name.

Someone an idea?

@StefanSoyka

Try this:

  Directory.GetFiles(“C:\UiPath\Hotfolder\”, “*.xlsx”, searchoption.AllDirectories)

That seems to work, thank you @lakshman

1 Like

@StefanSoyka

Glad to help you :slight_smile:

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