File Name is geting wrong extenction characters are added

InputFileInfo.Name.Substring(0,InputFileInfo.Name.Length-InputFileInfo.Extension.Length.ToString.Length)
“Client Documents.zi”

I need to get “Client Documents” but getting “Client Documents.zi”, zi need to remove Please suggest me .

Hey @meer.s
try to use:
InputFileInfo.Name.Substring(0, InputFileInfo.Name.Length - InputFileInfo.Extension.Length)

Hi @meer.s

Try this

Path.GetFileNameWithoutExtension(Input)

Regards,

1 Like

Hi @meer.s

Have corrected your above given code and below is the syntax:

InputFileInfo.Name.Substring(0, InputFileInfo.Name.Length - InputFileInfo.Extension.Length)

or you can use below syntax too:

Path.GetFileNameWithoutExtension(InputFileInfo.ToString)

Regards

1 Like

Thanks for the reply yes I have tried and found that I need remove .length in Extension command.

The Command is as: InputFileInfo.Name.Substring(0,InputFileInfo.Name.Length-InputFileInfo.Extension.ToString.Length)
and it worked. “Client Documents”

I thank you all for your suggestions.

Hi @meer.s

Since the query is resolved please mark the post as solution as it will help other community members.

Happy Automation
Regards

1 Like

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