Thursday, August 4, 2011

File System Statement : Part I I


GetAttr

Purpose : The GetAttr function lets you determine a file , directory or volume label's attributes.

Syntax :
GetAttr ( fileName$ )

if GetAttr ( fileName$ ) And vbHidden Then checkHidden.Value=CHECKED

Constants used with the GetAttr function
Constant : Value : Description
vbNormal : 0 : Normal
vbReadOnly : 1 : Read-Only
vbHidden : 2 : Hidden
vbSystem : 4 : System file
vbDirectory : 16 : Directory
vbArchive : 32 : File has changed since last backup
 
-----------------------------------------------

Kill

Purpose : The Kill Statement deletes the specified file from the disk.

Syntax :
Kill filename$

Kill File1.List ( File1.ListIndex )

in this example erases the file that is currently selected in the FileListBox named File1.
 
-----------------------------------------------

MKDir

Purpose : the MKDir statement creates a subdirectory on the specified drive.

Syntax :
MKDir dirname$

dirname$ must be in format of
[drive:][ \ ] dir [ \ subdir ] [ \ subdir ] ...

MKDir "TEST"
MKDir "\TEST"
MKDir "D:\TEST"

the first example creates the subdirectory TEST below the defult directory on the default drive.
the second line creates the subdirectory TEST below the root directory of the default drive.
and third example creates the subdirectory TEST below the root directory of the D drive.
 
-----------------------------------------------

Name

Purpose : The Name statement renames a file or directory or moves a file to another directory.

Syntax :
Name oldname As newname

Name "Test_1.Dat " As " Test_2.Dat "

in the example changes the name of the file Test_1.Date in the default directory to Test_2.Dat.
 
----------------------------------------------

RMDir

Purpose : The RMDir statement removes a subdirectory from a disk.

Syntax :
RmDir dirname$

dirname$ must be in the format of
[ dirve: ] [\] dir [ \ subdir ] [\ subdir ] .......

RmDir "TEST"
RmDir "\TEST"
RmDir "D:\TEST"
 
-----------------------------------------------

SetAttr

Purpose : The SetAttr Statement sets the attribut information for DOD files.

Syntax :
SetAttr filename$ , attrbuteBits%

SetAttr "MYFILE.TMP" , vbReadOnly , vbSystem

All file , directories and volumes have an attribute byte associated with then. This information indicates whether the filename is normal, read-only, hidden, system a volume label, a directory, or has been modified since the last backup.

Constants used with the SetAttr function
Constant : Value : Description
vbNormal : 0 : Normal
vbReadOnly : 1 : Read-Only
vbHidden : 2 : Hidden
vbSystem : 4 : System file
vbDirectory : 16 : Directory
vbArchive : 32 : File has changed since last backup

No comments:

Post a Comment