Extract File name from Path

Hi experts,

I am trying to extract File name from below path.
C:\Users\u6048949\Downloads\report1579017966725.xls

File name is “report1579017966725”. but I can’t retrive the file name from path. Please help me out from error.

And also trying “Getfilename” this activity i can’t find this activity.

2 Likes

have you tried using regex??

1 Like

this will return file name
[\w,\s-]+.[A-Za-z]{3}

Try to get all the file names in the folder into an array of strings with Directory.GetFiles(*your folder path). Then use a for each string in the array - use a replace function for the hard coded part of the path like string.replace(“C:\Users\u6048949\Downloads",”") - it will replace the hard coded part of the string with nothing and you will be left with report1579017966725.xls. Then you can use another replace for the .xls part.

Main.xaml (5.0 KB)

Check this workflow
cheers @karampuri_sathish

assign filename= filepath.Split("\".ToCharArray).Last

where filepath is your string variable containing full path “C:\Users\u6048949\Downloads\report1579017966725.xls”

13 Likes

@karampuri_sathish
You can use following dot net method for this within an assign

10 Likes

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