Hi,
I have this file path: C:\Users\carla-89\Downloads\convocatoria.xls (‘ExcelPath’ variable)
And I want to substract “convocatoria.xls” because each file i will wanna download will have a different name file. I try do:
StrExcelPath = ExcelPath.ToString
StrSplitExcelPath = StrExcelPath.split(""c).ToString
and then StrSplitExcelPath(4)
And only output and ‘e’.
What i need to do to extract only ‘convocatoria.xls’?
supriya117
(Supriya Allada)
July 6, 2023, 11:50am
2
Hi @Carla_Munoz
Try this for without extension:
filename = System.IO.Path.GetFileNameWithoutExtension(“path”)
For with extension:
filename = path.GetFileName(“path”)
or
filename = System.IO.Path.GetFileName(“path”)
Regards,
1 Like
@Carla_Munoz
Try this
path.GetFileName(ExcelPath)
this will give you file name with extension
1 Like
Gokul001
(Gokul Balaji)
July 6, 2023, 11:51am
4
HI @Carla_Munoz
How about this expression?
filename =Path.GetFileName(“C:\Users\carla-89\Downloads\convocatoria.xls ”)
Regards
Gokul
1 Like
Jithesh_R
(Jithesh Karkera)
July 6, 2023, 11:51am
5
@Carla_Munoz ,
If you want to get the filename with extension you can use
FileName= Path.GetFileName("FilePath")
Regards,
1 Like
hi @Carla_Munoz
Split(ExcelPath.tostring,“Downloads\”)(1)
1 Like
lrtetala
(Lakshman Reddy)
July 6, 2023, 11:54am
7
Hi @Carla_Munoz
Try this using split function
1 Like
Hello, what type of variable is FileName because is giving me an error
supriya117
(Supriya Allada)
July 6, 2023, 12:03pm
9
@Carla_Munoz
The filename variable is a “String” type
1 Like
@Carla_Munoz Its Type will be string type. It will return String
1 Like
mkankatala
(Mahesh Kankatala)
July 6, 2023, 12:43pm
11
Hi @Carla_Munoz
You can use the Split function to split the output. Split by using "".
- Assign -> StrFileName = StrExcelpath.Split("\").Last
Hope it helps!!
system
(system)
Closed
July 9, 2023, 12:43pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.