Get File Name without the extension

Hi everyone!

I’m using this item.ToString.Split("\“c).Last.ToString.Split(”."c)(0).ToString to get the filename without extension inside the folder. The problem is there are filenames which contains period, this is aside from the period before extension.

Original Filename(w/o) extension: Signed $ 3,983.73
Result: Signed $ 2,395.73

The decimal numbers are not captured. Any suggestion on getting the whole filename?

1 Like

@cldt - Path.getfilenamewithoutextension will give you the file name …

1 Like

Hi

Pls try like this in a assign activity inside the loop you are using

Str_filename = Path.GetFileNameWithoutExtension(item.ToString)

Item is your filepath

This will give you the FileName alone without its extension and your decimal points will be covered here

Str_filename is a variable of type string

Cheers @cldt

4 Likes

@cldt

Use Assign Activity and check as below

strFileName = Path.GetFileNameWithoutExtension(item.ToString)

Hope this may help you

Thanks

1 Like

Thanks everyone!

1 Like

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