Extract the last version name of a folder as a text string

Hi, I’m very new to RPA uipath world, hope you can help me, I would like to extract the most current folder name “app-XX.XX.X” from the directory.

Name Modification date
app-20.10.1 21/10/2020

app-20.10.2 26/10/2020 <—

Hello @Enrique.ts and welcome to the UiPath Community forums :partying_face:

Once you have folder name into a string variable:
app-20.10.1 21/10/2020

And you would like to obtain the date, you can use a “Matches” activity.
Preview the result here on Regex101.com

The result will be an ienumerable and to convert to string use an assign activity:
MATCHESOUTPUTVARIABLE(0).tostring = string.variable

Update capital letters above with Matches activity “Result”.

If you want to learn Regex, check out my MegaPost for a tutorial, sample workflow and more.

Hopefully this helps :blush:


Hi Steven, thanks for your comment, I wanted to clarify that the date is not part of the folder name, as it shows you in this image


C:\Users\ -myname- \AppData\Local\UiPath\app-20.10.2

With your answer do you think I could use it to get the folder with the newest version “app-XX.XX.X” from the directory?

I require a process that detects the latest version of UiPath installed.


Take a look at this post.

" used this expression to get the name of the latest folder created based on the creation date and it gave me the folder name back, only the name not the full path and it’s stored into a variable of type “directory.info”

variable name is “name”
{New DirectoryInfo(“my path”).GetDirectories().OrderByDescending(function(d) d.CreationTime).First()}"

Hopefully this helps you :blush:

1 Like

Prototyping it with short values:

the last app entry can be found with a Regex, Linq Combination:

(From x In arrNames
Where Regex.IsMatch(x,"(?<=app-)\d{2}.\d{2}.\d{1,2}\b")
Let m = Regex.Match(x,"(?<=app-)(\d{2}).(\d{2}).(\d{1,2})\b")
Order By CInt(m.Groups(1).Value),CInt(m.Groups(2).Value),CInt(m.Groups(3).Value)
Select x).Last

find starter help here:
Enrique.ts.xaml (4.9 KB)


Thanks to both of you @ppr @Steven_McKeering, your comments were very helpful to me, but
@ppr response using Regex was what I used since it gives me the entire path where the folder is located and of course the most important thing is that it gives me the latest version

1 Like

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