I need to extract all the subFolder(including subFolder of subfolders)

hi team,

I have a new case.

i need to find all the subfolders of subfolders.

like assume that i have folder A–inside–A1 and A2 subfolders.
Inside A1 folder their will be again 2 folder A1a and A1b
inside A1a ----A1a1 folder and A!a2 folder also.

is their any way to extract all the folders at once.
Directory.GetDirectories(“Path”)—this is help to get A sub folders only.

if any way to find please help.

Thanks.

Hi @manipreethi410

How about this expression to get all the subfolder

Directory.GetFiles(Environment.CurrentDirectory+"\Input\Banking Files\","*.*",SearchOption.AllDirectories)

Or You can try with For Each Folder in Folder

Regards
Gokul

1 Like

Hi @manipreethi410

Try this expression
Directory.GetDirectories(“”,SearchOption.AllDirectories)

Regards
Sudharsan

am Using old version of uipath to use foreach folder

Okay no Worries @manipreethi410

You can try with above expression

  1. Use assign activity
LHS : Input1 | Array(String)

Regards
Gokul

this will help to get all files. need to get all sub folders.

Thanks in advance


getting this error.

Hi @manipreethi410

Check out the Video Link

Regards
Gokul

Try like this

system.IO.Directory.GetFiles(Environment.CurrentDirectory+"\Input\Banking Files\","*.*",SearchOption.AllDirectories)

Regards
Gokul

@manipreethi410
Change the folder datatype into
System.String[ array]

And check on this too

Directory.GetDirectories("",System.IO.SearchOption.AllDirectories)

Regards
Sudharsan

still the same error, do i need to download any package or import any namespace?

Have you changed the datatype of folder variable?

yes, am using array of string.

Hi @manipreethi410

Try like the below expression

Directory.GetDirectories("Yourpath","",System.IO.SearchOption.AllDirectories)

Regards
Gokul

Error is no more but am not getting any sub folder name form this.

Try this

Directory.GetDirectories(Directory.GetCurrentDirectory)

or

Directory.GetDirectories("youFolderPath","*.*",SearchOption.AllDirectories)

Regards
Sudharsan

Checkout this one

Hi @manipreethi410

Check out the XAML file

GetSubFolder.xaml (6.3 KB)

Regards
Gokul

1 Like

this helped me to get 1 folder’s subfolder. i need to get subfolder’s subfolder.

is that possible?

this helped me to get 1 folder’s subfolder. i need to get subfolder’s subfolder.

is that possible?