Format
string1=FIND FIRST (string2,number1)
string1=FIND CONTINUE
Description
The FIND command is used to search the current file directory for file(s)
which match a search string. This command has two versions. FIND FIRST
must be used to establish a new search and retrieve the first matching file
name. Thereafter, the FIND CONTINUE will retrieve additional file names
which match the search string. When performing the FIND FIRST, string2
should contain the full or partial file name to be searched for. This
string can be up to 8 alphanumeric characters optionally followed by a
period and up to 3 alphanumeric characters for the file extension.
Standard DOS wild cards "*" and "?" may be included in the search string.
Number1 is used to specify a file attribute. If number1 is "0", then all
normal files in the directory will be searched. (A normal file is one in
which the hidden, system, volume label, or directory attribute bit is NOT
set). Setting various bits (see table below) of number1 ON will expand the
search to include normal files, plus those whose attributes have been
specified in number1. If a matching file name is found, then it will be
stored in string1. If an error occurs, then the system ERROR variable will
be set. A list of ERROR codes is contained in the ERROR code chapter of
the ASIC Manual. After the initial FIND FIRST has been performed, you may
search for additional files which match the search string and attribute by
issuing a FIND CONTINUE statement.
Search Attributes bits (number1)
Bit |
|
0 |
Not Used |
1 |
Hidden |
2 |
System |
3 |
Volume Label |
4 |
Subdirectory |
5-7 |
Not Used |
Note that these attributes can all be specified simultaneously. For
example, to specify both hidden and system, use an attribute value of
&bin00000110 (in binary) or 6 (in decimal).
Example
SEARCH$="*.ASI"
ATTRIB=0
FILENAME$=FIND FIRST (SEARCH$,ATTRIB)
IF ERROR>0 THEN DONE:
PRINT A$
LOOP:FILENAME$=FIND CONTINUE
IF ERROR>0 THEN DONE:
PRINT A$
GOTO LOOP
DONE: PRINT "ALL MATCHING FILES DISPLAYED"
END
After execution of the above statements, all of the files with a file
extension of ".ASI" in the current directory will be displayed on the
screen.
Comments
If you execute a FIND CONTINUE without executing a FIND FIRST, then the
results are unpredictable. Additional information is retrieved by the FIND
command besides the file name. Advanced programmers can also find
additional information using the PEEK command starting at offset 149 (from
the default ASIC data segment). Do not modify this data. If you do so,
the results are unpredictable.
Additional File Information
Address |
Size (bytes) |
Description |
149 |
1 |
File Attribute |
150 |
2 |
File Time Stamp |
152 |
2 |
File Date Stamp |
154 |
4 |
File Size (bytes) |
See Also
-
NAME
- KILL
- GETDIR
- CHDIR
- MKDIR
- RMDIR
|
|