Save subfolder name to variable

Hi all, I have a

Folder path C:\users\00001
In the folder are approximately 1000 subfolders with “process ID” names.

Example C:\users\00001\abcd-1234-efgh

I need to save the subfolder name to a variable to use it in the later process. But I don’t get it.

Can you help me here? The order of the subfolder processing is not restricted to something. I need all subfolder names one by one.

Thanks and best regards!


You can try as below to get all the folders in the path

  1. Declare a String variable let’s say as ListofFolders
  2. Use Assign activity and write as below
    ListofFolders = Directory.GetDirectories(“C:\users\00001”)
  3. Use For Each activity and change the TypeArgument to String in properties
  4. Inside For Each you can keep a write line message and write as Item.ToString which will give you the all the each directory it contains

Hope this may help you


1 Like

Hi Srini, thanks for ur help.

thats what i did… but didnt changed my “for each” to string … thanks a lot!


1 Like


Great, If you resolved your issue
Click on the Mark as solution to the appropriate post to close this thread
It will help others as well


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