2009 Jan 07 7:37 AM
Hi,
I need to read only the file name from a variable which contains the entire path and also the name of the file at the end of it.
Eg:
lh_path is a character variable.
lh_path = E:\xxxxx\yyyyyy\zzzz\........\Objects.csv
In this example, i need to read only the file name(i.e Objects.csv) from lh_path.What will be the best logic to implement this?
Thanks in advance,
Anindya
2009 Jan 07 7:40 AM
Hi,
I need to read only the file name from a variable which contains the entire path and also the name of the file at the end of it.
Eg:
lh_path is a character variable.
lh_path = E:\xxxxx\yyyyyy\zzzz\........\Objects.csv
In this example, i need to read only the file name(i.e Objects.csv) from lh_path.What will be the best logic to implement this?
Thanks in advance,
Anindya
2009 Jan 07 7:40 AM
2009 Jan 07 7:45 AM
Hi,
Use the SPLIT statment. Use an internal table as the target and read the last record of the target internal table. This will always be the file name.
regards,
Advait
2009 Jan 07 7:45 AM
2009 Jan 07 8:06 AM
2009 Jan 07 8:18 AM
Hi,
Try this code
data:text1 type string,itab type table of string.
parameters : text type string. "file name
split text at '\' into table itab.
loop at itab into text1 .
* text1 = itab.
endloop.
write : text1.
Regards
Vasavi Kotha
Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 3:20 PM
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |