Hi I am fairly new with UiPath and trying to create a process where it can extract the folder names within a folder and paste into Excel as a list. I been trying with the “For each folder in folder” function and not sure what to do after that.
I just need the folder names to be copy and pasted essentially, I do not need the files names inside the folders.
To extract folder names within a folder and paste them into an Excel list using UiPath, you can follow these steps:
Use the “Assign” activity to create a variable to store the folder names. Let’s call it folderList and initialize it as an empty list or an empty array of strings.
Use the “For Each” activity to iterate through each folder within the main folder.
Set the TypeArgument of the “For Each” activity to System.IO.DirectoryInfo.
In the “Properties” section of the activity, set the Directory property to the path of the main folder.
Inside the loop, use the “Add to Collection” activity to add the name of each folder to the folderList variable.
Set the Collection property to folderList.
Set the Item property to folder.Name.
After the loop, use the “Write Range” activity to write the folder names to an Excel file.
Set the DataTable property to folderList.ToArray().CopyToDataTable().
Specify the range where you want to paste the data.
If that worked can you mark the post as solution.
and to the part where you need only Numbers from your folder name’
Use something like this:
Regex.Match(“RPA GGG 123”,“\d+”).Value
It will give you only digits.