FILES: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "The FILES statement is used to print a list of files in the current directory using a file specification. {{PageSyntax}} : FILES [{{Parameter|fileSpec$}}] {{PageDescription}} * {{Parameter|fileSpec$}} is a string expression or variable containing a path when required. * {{Parameter|fileSpec$}} can use the * and ? wildcard specifications: ** '''*''' denotes one or more wildcard characters in a filename or path specification as any legal file name character(s)...") |
(Remove legacy info and add _FILES$ to "See Also") |
||
(6 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
* {{Parameter|fileSpec$}} can use the * and ? wildcard specifications: | * {{Parameter|fileSpec$}} can use the * and ? wildcard specifications: | ||
** '''*''' denotes one or more wildcard characters in a filename or path specification as any legal file name character(s). | ** '''*''' denotes one or more wildcard characters in a filename or path specification as any legal file name character(s). | ||
** '''?''' denotes one wildcard letter in a filename or path specification as any legal filename character. | ** '''?''' denotes one wildcard letter in a filename or path specification as any legal filename character. | ||
* If {{Parameter|fileSpec$}} is omitted, it is assumed to be '''"*.*"''' (all files and folders in the current directory). | * If {{Parameter|fileSpec$}} is omitted, it is assumed to be '''"*.*"''' (all files and folders in the current directory). | ||
* Illegal filename characters in '''QB64''' include * > < : " | \ / with any amount of dot extensions being allowed in Windows. | * Illegal filename characters in '''QB64''' include * > < : " | \ / with any amount of dot extensions being allowed in Windows. | ||
* FILES lists can make the screen roll up. Try using SHELL "DIR" with the /P option. [http://www.computerhope.com/dirhlp.htm DIR command]. | * FILES lists can make the screen roll up. Try using SHELL "DIR" with the /P option. [http://www.computerhope.com/dirhlp.htm DIR command]. | ||
* To get individual directory entries use [[_FILES$]] instead. | |||
* | |||
{{PageExamples}} | {{PageExamples}} | ||
''Example 1:'' Finding a list of all BAS files in the current folder. | ; ''Example 1:'' Finding a list of all BAS files in the current folder. | ||
{{CodeStart}}{{Cl|FILES}} "*.BAS" | {{CodeStart}}{{Cl|FILES}} "*.BAS" | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[ | * [[_FILES$]] | ||
* [[SHELL]] | |||
* [[CHDIR]], [[MKDIR]] | * [[CHDIR]], [[MKDIR]] | ||
* [[RMDIR]], [[KILL]] | * [[RMDIR]], [[KILL]] | ||
* [[_CWD$]], [[_STARTDIR$]] | * [[_CWD$]], [[_STARTDIR$]] | ||
* [[_FILEEXISTS]], [[_DIREXISTS]] | * [[_FILEEXISTS]], [[_DIREXISTS]] | ||
* [[$CONSOLE]] | * [[$CONSOLE]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 00:14, 3 January 2024
The FILES statement is used to print a list of files in the current directory using a file specification.
Syntax
- FILES [fileSpec$]
Description
- fileSpec$ is a string expression or variable containing a path when required.
- fileSpec$ can use the * and ? wildcard specifications:
- * denotes one or more wildcard characters in a filename or path specification as any legal file name character(s).
- ? denotes one wildcard letter in a filename or path specification as any legal filename character.
- If fileSpec$ is omitted, it is assumed to be "*.*" (all files and folders in the current directory).
- Illegal filename characters in QB64 include * > < : " | \ / with any amount of dot extensions being allowed in Windows.
- FILES lists can make the screen roll up. Try using SHELL "DIR" with the /P option. DIR command.
- To get individual directory entries use _FILES$ instead.
Examples
- Example 1: Finding a list of all BAS files in the current folder.
FILES "*.BAS" |
See also