cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get Root files and folder

PoojaVerma
Level 2
i have a root folder with multiple sub folders and those sub folders could have more sub folders. I want to run an action and pass it the base folder and get all files that are contained in there (Even in sub folders). The Get files action only gets the files at the first level and to use get folders you'd need to create a huge process which checks every level to see if there are more sub folders and you could potentially miss some files.

------------------------------
Pooja Verma
------------------------------
2 REPLIES 2

If you want to use Powershell then this would be the command to get all the files in the folder recursively

Get-ChildItem -Recurse "C:\myfolder" | Where { ! $_.PSIsContainer } | Select Name,FullName

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

PabloSarabia
Level 11
Hi @Pooja Verma

If you are using the VBO "Utility - File Management" with the Action "Get Files"​, you can edit a little bit the code to achieve this.

In the line 34, change the line with this code: 

aFiles = oDirectory.GetFiles(sPattern.Trim, SearchOption.AllDirectories)​


With the argument "SearchOption.AllDirectories" you will get all the files in all subdirectories from the root folder.


Hope this helps you!

See you in the Community, bye 🙂



------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------