How to get the date from a folder name

For Example:

I want to get the date from this Path:


So, I need to get just the date.

The output I need is “092820”

1 Like

Hi @Marcela_Lugo,

you can use Matches activity and pass \d+ to get the numbers out of it.


Hi @Marcela_Lugo

Please try it out by using “Matches” Activity.
Then in the properties panel “Input” Textbox must contain your path as “D:\Usuarios\lucy\descargas\prueba\DocumentoFacturas092820.xlsx” or any variable where your “path” is present.


Then in “Pattern” Textbox give the value as “([0-9])\w+” inside double quotes, Then assign any variable to the “Result” Textbox and Put a write line below the Matches activity and give the expression as the VariableyougiveninResultSection(0).ToString

Thanks !!!

If you are sure your path does not contain any digits except for the date, you can use

output = System.Text.RegularExpressions.Regex.Replace(your_path, “[^0-9]”,"")

[optional] Later, if you need to convert that to an actual Date
your_date = DateTime.ParseExact(output, “MMddyy”, Nothing)

Thanks! But now I get the number in separate lines.

Now, this is my output:


How can I get the number in a single line?

I could resolve this using ToString.join, thanks to all for the help :slight_smile:

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