Check filename

Hi again friends,

I have to files with diffrent names in the end of the filename.

One ends with this name Country.pdf
The other ends with this name CountryCode.pdf

How should i write to check the last part of the filename.

Greetings
Anders

Hi @Anders_Dahl

try this

fileList = Directory.GetFiles(folderPath)

ForEach fileName in fileList
filePathWithoutExtn = Path.GetFileNameWithoutExtension(fileName)

and based on that use path exists activity to do any manipulations

Thanks
Ashwin S

2 Likes

Hi @AshwinS2

I will try this. I tell the result when i am done.

/Anders

Path.GetFileNameWithoutExtension(fileName)

1 Like

Instead you can use simple and ready to use ‘Get file name’ activity developed by @lakshman.
You need to download ‘GetFileName.Activities’ package using ‘Manage packages’ in Design Tab. @Anders_Dahl
image

Output will be of Datatype-String. Below is the screenshot for reference.

2 Likes

Thanks @Mahesh_Gunda

I will look at this :slight_smile:

Cheers!

1 Like

Thanks @Fer

:slight_smile:

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