# String Extract Error

**URL:** <https://forum.uipath.com/t/string-extract-error/484292>\
**Category:** Studio\
**Tags:** assign, uipath, path, activities-panel, question, studio, system, activities\
**Created:** [October 25, 2022, 2:38pm UTC](https://forum.uipath.com/t/string-extract-error/484292 "2022-10-25T14:38:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.ulutas](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/d.ulutas/32/266382_2.png) [@d.ulutas](https://forum.uipath.com/u/d.ulutas)\
**Post date:** [October 25, 2022, 2:38pm UTC](https://forum.uipath.com/t/string-extract-error/484292/1 "2022-10-25T14:38:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![omer.ozturk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/omer.ozturk/32/337143_2.png) [@omer.ozturk](https://forum.uipath.com/u/omer.ozturk)\
**Post date:** [October 25, 2022, 2:40pm UTC](https://forum.uipath.com/t/string-extract-error/484292/2 "2022-10-25T14:40:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Roman\_hruska](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/roman_hruska/32/239628_2.png) [@Roman\_hruska](https://forum.uipath.com/u/Roman_hruska)\
**Post date:** [October 25, 2022, 2:42pm UTC](https://forum.uipath.com/t/string-extract-error/484292/3 "2022-10-25T14:42:42Z")

</div>

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

 ![image](https://global.discourse-cdn.com/uipath/original/4X/e/2/1/e218bfe3d65ac601e7c98b9b29dc8dc97de66653.png)  
Roman

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [October 25, 2022, 2:51pm UTC](https://forum.uipath.com/t/string-extract-error/484292/4 "2022-10-25T14:51:52Z")

</div>

> [@d.ulutas](#):
>
> How can I get only the pdf name anyway?

@d.ulutas ,

You Could Check with the below Expression :

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

```

---

<div class="post-metadata">

**Author:** ![Sudharsan\_Ka](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudharsan_ka/32/459826_2.png) [@Sudharsan\_Ka](https://forum.uipath.com/u/Sudharsan_Ka)\
**Post date:** [October 25, 2022, 3:16pm UTC](https://forum.uipath.com/t/string-extract-error/484292/5 "2022-10-25T15:16:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shaik\_Azam](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/shaik_azam/32/190410_2.png) [@shaik\_Azam](https://forum.uipath.com/u/shaik_Azam)\
**Post date:** [October 25, 2022, 3:40pm UTC](https://forum.uipath.com/t/string-extract-error/484292/6 "2022-10-25T15:40:14Z")

</div>

Hi @d.ulutas,

you can also this way as in below screenshot

 ![image](https://global.discourse-cdn.com/uipath/original/4X/b/9/2/b92673057b6863a5e932397fc13c030d4da2c8ee.png)

---

<div class="post-metadata">

**Author:** ![Gokul001](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gokul001/32/462734_2.png) [@Gokul001](https://forum.uipath.com/u/Gokul001)\
**Post date:** [October 25, 2022, 4:24pm UTC](https://forum.uipath.com/t/string-extract-error/484292/7 "2022-10-25T16:24:57Z")

</div>

Hi @d.ulutas

Try with this expression

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

Regards  
Gokul
