Get Last word of the path

Hello Team,

I need a help to get the before the file name folder path

Input String = “C:\Users\ROBOT\RBL\Bank_advice_Database.xlsx”

Output = RBL

Thanks and regards
Shriharsha H N

Hi,

Can you try the following?

System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(yourString))

Regards,

Hi,

Can you try the following?

Input = “C:\Users\ROBOT\RBL\Bank_advice_Database.xlsx”
Output = new DirectoryInfo(Path.GetDirectoryName(Input)).Name

Hi @Shriharsha_H_N

Welcome to UiPath Forum

Please try the below one,

InputString.Split("\“c)(InputString.Split(”\"c).count-1)

Thanks, Happy Automation

YourFilePath = “C:_demo\SubfolderA\Today.txt”
new FileInfo(YourFilePath ).Directory.Name
would return: SubfolderA as String

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