Marked as: Easy
Hello,
Did you know that you can use the built in function FILESPEC to to extract drive, path and filename from not only local paths but also network paths (UNC-path) and URLs?
Note that the last example "file:///c:/.." contain 2 "drives", so you may need to create additional code for that scenario.
/* Filespec to extract drive, path and filename from URL */
url.1 = 'C:\os2\cmd.exe'
url.2 = '\\network_server\path\filename.txt'
url.3 = 'http://www.os2world.com/index.html'
url.4 = 'ftp://xwp.netlabs.org/readme.txt'
url.5 = 'file:///c:/temp/doc/faq.txt'
url.0 = 5
do i = 1 to url.0
say 'Drive: 'filespec( 'D', url.i )
say 'Path: 'filespec( 'P', url.i )
say 'Name: 'filespec( 'N', url.i )
end