|
The FILEINFO$
function parses a file specification and returns either a full file
specification or specific file specification fields.
FILEINFO$(str_expr1 [, str_expr2 [, str_expr3]])
str_expr1
- The file specification to be parsed. If no file specification is given, the device and directory you are currently running from are returned.str_expr2
- A list of field names, separated by commas, which are to be returned. The field names are:
CONTENTS
- File contentsDEVICE
- Drive nameDIRECTORY
- Directory nameNAME
- File nameTYPE
- Type or extension nameLOCATION
- Device and directory namesBACKUP_DATE
- Last file backup dateCREATION_DATE
- Date file was createdEXPIRATION_DATE
- File expiration dateREVISION_DATE
- Date file was last modifiedREVISION
- The number of times a given file has been revised (given that the underlying OS supports this)SIZE
- The size of the file in bytesALL
or ""
- Full file specificationstr_expr3
- The default file specification. This parameter is optional.
print fileinfo$('x.y', 'ALL')
print fileinfo$('', 'ALL')
end
Output:
c:\Sheerpower\x.y
c:\Sheerpower
x$ = 'Sheerpower:samples\client'
print fileinfo$(x$, 'ALL', '.ars')
end
Output:
c:\Sheerpower\samples\client.ars
print fileinfo$('Sheerpower:\samples\client', 'all', '.ars')
print fileinfo$('Sheerpower:\samples\client', 'location')
print fileinfo$('Sheerpower:\samples\client', 'location, name')
print fileinfo$('Sheerpower:\samples\client.ars')
end
Output:
c:\Sheerpower\samples\client.ars
c:\Sheerpower\samples\
c:\Sheerpower\samples\client
c:\Sheerpower\samples\client.ars
The CONTENTS
option of FILEINFO$
returns the entire contents of the file 'some_file.xxx' into all_of_file$
. If the file cannot be found, then it returns a null string. A zero-length file will also return a null string.
all_of_file$ = fileinfo$('some_file.xxx', 'contents')
all_of_file$ = fileinfo$('Sheerpower:Sheerpower.ini', 'contents')
print all_of_file$
end
Output:
[license]
LicenseKey=F0CE-2E43-7583-3130-3030-3030-3131-0003-873F-000A
Username=non-commercial
EmailAddress=non-commercial
sourcefile$ = 'source.xxx'
destfile$ = 'destination.xxx'
contents$ = fileinfo$(sourcefile$, 'contents')
open file dest_ch: name destfile$, access output, unformatted
print #dest_ch: contents$
close #x
end
Hide Description
|
|
Enter or modify the code below, and then click on RUN |
Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use. |