Syntax |
FileParse$(filename$[, operation]) |
||
Description |
Returns a String containing a portion of filename$ such as the path, drive, or file extension. |
||
Comments |
The filename$ parameter can specify any valid filename (it does not have to exist). For example: ..\test.dat A runtime error is generated if filename$ is a zero-length string. The optional operation parameter is an Integer specifying which portion of the filename$ to extract. It can be any of the following values. |
||
|
Value |
Meaning |
Example |
|
0 |
Full name |
c:\sheets\test.dat |
|
1 |
Drive |
c |
|
2 |
Path |
c:\sheets |
|
3 |
Name |
test.dat |
|
4 |
Root |
test |
|
5 |
Extension |
dat |
|
If operation is not specified, then the full name is returned. A runtime error will result if operation is not one of the above values. A runtime error results if filename$ is empty. |
||
Example |
This example parses the file string c:\temp\autoexec.bat into its component parts and displays them in a dialog box. Const crlf = Chr$(13) + Chr$(10) Sub Main() msg1 = "The breakdown of '" &
file$ & "' is:" & crlf & crlf |
||
See Also |
FileLen (function); GetAttr (function); FileAttr (function); FileExists (function). |
||
Note |
The backslash and forward slash can be used interchangeably. For example, c:\test.dat is the same as c:/test.dat. |
F |