How to get name of the first file in a folder?

Hi,
How can I get the name of a first file in a folder.
My files like this
TT13245.pdf
TT5637.pdf
I want to get the name as TT12345.
Thanks.

HI @makboga

You can try with this expression

Path.GetFileNameWithoutExtension("C:\Users\Dell\Documents\UiPath\Test\T13245.pdf")

Regards
Gokul

image

I use this for different folders and every folder has different files. I’ll make a for each loop and I want the name of the first file for each folder.

Hi @makboga

Inside for each loop you can use Counter and get only the First file name of the folder.

Some thing like in the below image

Regards
Gokul

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