Description

Used to set attributes for the file mask used by the InitDir statement and DirList function.

Syntax

SetInitDirOptions (attributes)

Parameters

The attributes parameter is a combination of the following characters:

N Normal

A Archive

R Read-only

H Hidden

S System

D sub-Directories

V Volume label

T Temporary

C Compressed

The "-" syntax is supported to exclude file types.

To specify the default attributes, pass null ("") for the attributes parameter. The default attributes are "-R-H-S-D".

To use SetInitDirOptions, call it before using the InitDir statement.

The options are automatically reset after use. In other words, you do not have to reset the options after using SetInitDirOptions/InitDir/DirList because they are reset to their defaults automatically. This means that you must use SetInitDirOptions before each InitDir if you do not want to use the default options.

See also

DirList()InitDir

Example

Function Test_SetInitDirOptions(parent)
 
Declare Function dirlist, Unassigned, Msg
Declare subroutine setinitdiroptions, initdir
 
dir = "C:\*.*"
 
* Return the default option
InitDir dir
list_default = dirList()
 
* Return the default option
SetInitDirOptions("")
InitDir dir
list_all = dirList()
 
* Returns Subdirectories
SetInitDirOptions("D")
InitDir dir
list_directories = dirList()
 
* Returns hidden files
SetInitDirOptions("H")
InitDir dir
list_hidden = dirList()
 
* Returns ReadOnly files
SetInitDirOptions("R")
InitDir dir
list_readonly = dirList()
 
* Returns system files
SetInitDirOptions("S")
InitDir dir
list_system = dirList()
 
* Returns archived fileds
SetInitDirOptions("A")
InitDir dir
list_archive = dirList()
 
* Returns normal files
SetInitDirOptions("N")
InitDir dir
list_normal = dirList()
 
* Returns temporary files
SetInitDirOptions("T")
InitDir dir
list_temporary = dirList()
 
* Returns compressed files
SetInitDirOptions("C")
InitDir dir
list_compressed = dirList()
 
 
* Return the default option
SetInitDirOptions("-R-H-S-D")
InitDir dir
list_all = dirList()
 
* Return hidden and read only files
SetInitDirOptions("HR")
InitDir dir
list_hidden_and_readonly = dirList()
 
* Return hidden but not read only files
SetInitDirOptions("H-R")
InitDir dir
list_hidden_and_not_readonly = dirList()
 
* Return Directories which are hidden and read only
SetInitDirOptions("HDR")
InitDir dir
list_hidden_and_readonly_and_dirs = dirList()
 
Return
  • No labels