ChDir Procedure | Microsoft.VisualBasic.FileSystem |
ChDir(path) |
|
path required; String
The path of the directory to set as the new default directory
Changes the current working (default) directory.
ChDrive Procedure | Microsoft.VisualBasic.FileSystem |
ChDrive(drive) |
|
drive required; String or Char
The letter of the drive (A-Z) to set as the new default drive
Changes the current working (default) disk drive.
CurDir Function | Microsoft.VisualBasic.FileSystem |
CurDir[(drive)] |
|
drive optional; String or Char
The name of the drive
A String containing the current path
Returns the current directory of a particular drive or the default drive.
If no drive is specified or if drive is a zero-length string (""), CurDir returns the path for the current drive.
drive can be the single-letter drive name with or without a colon (i.e., both "C" and "C:" are valid values for drive).
If drive is invalid, the function will generate an 10Exception exception.
Because CurDir can only accept a single-character string, you cannot use network drive names, share names, or UNC drive names.
Dir Function | Microsoft.VisualBasic.FileSystem |
Dir[(pathname[, attributes])] |
|
pathname optional; String
A string expression that defines a path, which may contain a drive name, a folder name, and a filename
attributes optional; Numeric or Constant of the FileAttribute enumeration
The file attributes to be matched
String
Returns the name of a single file or folder matching the pattern and attribute passed to the function.
A zero-length string ("") is returned if a matching file is not found.
Possible values for attributes are:
FileAttributeenumeration | Value | Description |
Normal | 0 | Normal (not hidden and not a system file) |
ReadOnly | 1 | Read-only file |
Hidden | 2 | Hidden |
System | 4 | System file |
Volume | 8 | Volume label; if specified, all other attributes are ignored |
Directory | 16 | Directory or folder |
Archive | 32 | Archive |
Alias | 64 | Alias or link |
FileCopy Procedure | Microsoft.VisualBasic.FileSystem |
FileCopy(source, destination) |
|
source required; String
The name of the source file to be copied
destination required; String
The name and location of the file when copied
None
Copies a file.
FileDateTime Function | Microsoft.VisualBasic.FileSystem |
FileDateTime(pathname) |
|
pathname required; String
The filename, along with an optional drive and path
A Date containing the date and time at which the specified file was created or last modified
Obtains the date and time at which a particular file was created or last modified (whichever is later).
GetAttr Function | Microsoft. VisualBasic.FileSystem |
GetAttr(pathname) |
|
pathname required; String
Filename and an optional pathname
An integer representing the sum of the following constants or members of the FileAttribute enumeration, which reflect the attributes set for the file:
FileAttribute Numeration | Constant | Value | Description |
Normal | VbNormal | 0 | Normal |
ReadOnly | VbReadOnly | 1 | Read-only |
Hidden | VbHidden | 2 | Hidden |
System | VbSystem | 4 | System |
Directory | VbDirectory | 16 | Directory or folder |
Archive | VbArchive | 32 | File has changed since last backup |
Determines which attributes have been set for a file or directory
Kill Procedure | Microsoft.VisualBasic.FileSystem |
Kill(pathname) |
|
pathname required; String
The file or files to be deleted
Deletes a file from disk. The ? and * wildcard characters can be used to specify multiple files.
MkDir Procedure | Microsoft.VisualBasic.FileSystem |
MkDir(path) |
|
path required; String
The name of the folder to be created
Creates a new folder.
Rename Procedure | Microsoft.VisualBasic.FileSystem |
Rename(oldpath, newpath) |
|
oldpath required; String
The current filename and optional path
newpath required; String
The new filename and optional path
Renames a disk file or folder.
RmDir Procedure | Microsoft.VisualBasic.FileSystem |
RmDir(path) |
|
path required; String
The path of the folder to be removed
Removes a folder.
SetAttr Procedure | Microsoft.VisualBasic.FileSystem |
SetAttr(pathname, attributes) |
|
pathname required; String
The name of the file or directory whose attributes are to be set
attributes required; FileAttribute enumeration
Numeric expression, FileAttribute enumerated constant, or global VB constant specifying the attributes
Changes the attribute properties of a file.
You can use any sum of the following constants to set the attributes of a file:
Constant | Value | Description |
VbNormal | 0 | Normal |
VbReadOnly | 1 | Read-only |
VbHidden | 2 | Hidden |
VbSystem | 4 | System |
VbArchive | 32 | File has changed since last backup |
Each global constant has a corresponding constant in the FileAttribute enumeration. For example, vbNormal is identical to FileAttribute.Normal. The file-attribute constants vbDirectory, vbAlias, and vbVolume cannot be used when assigning attributes.
File-attributes constants can be Ored to set more than one attribute at the same time. For example:
SetAttr "SysFile.Dat", FileAttribute.System Or FileAttribute.Hidden
Unlock Procedure | Microsoft.VisualBasic.FileSystem |
Unlock(filenumber[, record) Unlock(filenumber[, fromrecord[, torecord]]) |
|
filenumber required; Integer
Any valid file number
record required; Long
The record or byte number at which to commence the lock
fromrecord required; Long
The first record or byte number to lock
torecord required; Long
The last record or byte number to lock
Use the Unlock procedure in situations where more than one part of your program may need read and write access to the same data file. The Unlock procedure removes a lock that the Lock procedure placed on a section of the file or the whole file.
Write Procedure | Microsoft.VisualBasic.FileSystem |
Write(filenumber, output) |
|
filenumber required; Integer
Any valid file number
output required; Object (any)
A comma-delimited list of expressions or a ParamArray to be written to the file.
No
Writes data to a sequential file
WriteLine Procedure | Microsoft.VisualBasic.FileSystem |
WriteLine(filenumber, [output]) |
|
filenumber required; Integer
Any valid file number
output optional; Object (any)
A comma-delimited list of expressions or a ParamArray to be written to the file
No
Writes data to a sequential file and then adds a line-feed character combination