String Extract Error

Hello there,

i have one file path;

“C:\Users\uipath\Desktop\Home24\559690.PDF”

“559690.PDF” may vary

Example;

“C:\Users\uipath\Desktop\Home24\232131690.PDF”

How can I get only the pdf name anyway?

Hi @d.ulutas,

You can get your files into an array.

Then you can do your job in for each. Please try this assign to get pdf files.

Directory.GetFiles("C:\Users\uipath\Desktop\Home24","*.pdf")

Regards.
Ömer

1 Like

Hi Utulas,
this activity will certainly help you.
You can get the name of each file as demonstrated in WriteLine:


Roman

@d.ulutas ,

You Could Check with the below Expression :

Path.GetFileName("C:\Users\uipath\Desktop\Home24\232131690.PDF")

Hi @d.ulutas
I’d you want with extension you can try with @supermanPunch expression

If you want without extension try this

Path.GetFileNameWithoutExtension(“C:\Users\uipath\Desktop\Home24\anything.pdf”)

Regards
Sudharsan

Hi @d.ulutas,

you can also this way as in below screenshot

Hi @d.ulutas

Try with this expression

Path.GetFileNameWithoutExtension(“C:\Users\uipath\Desktop\Home24\anything.pdf”)

Regards
Gokul