File, directory and disk manipulation routines to copy, delete, and move files, folder and subfolders
Visual Basic offers many built-in commands and functions for working with files and disks.
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the modFileDisk module
|
|
AddLineNumbersToFile
|
Procedure
|
Adds line numbers to a text file
|
|
AppendToTextFile
|
Procedure
|
Appends the supplied string to the named text file
|
|
AvailableDrives
|
Procedure
|
Determines which drives are currently available
|
|
CopyDirectory
|
Procedure
|
Copies all the files from one directory (folder) to another
Note: does not copy files in sub-directories
|
|
CopyFile
|
Procedure
|
Copies a file
|
|
CountLinesInTextFile
|
Procedure
|
Count the number of line in a text file
|
|
CreateFileFromText
|
Procedure
|
Create (save) a file containing the text you provide
|
|
DirectoriesToArray
|
Procedure
|
Populates the passed array with a list of directories in the specified directory (folder)
|
|
DirectoryExists
|
Procedure
|
Determines if a directory (folder) exists as specified by drive letter (e.g. C:\)
|
|
DirectoryExistsUNC
|
Procedure
|
Determines if a folder (directory) exists including references to universal naming convention (UNC) folders
|
|
DriveExists
|
Procedure
|
Determines if a drive letter exists
|
|
FileExists
|
Procedure
|
Determines if a file name exists (returns TRUE if the file is a folder which exists)
|
|
FilesInSubFoldersToArray
|
Procedure
|
Create a list of all files with their full path in the specified directory and all its subfolders
|
|
FilesToArray
|
Procedure
|
Populates the passed array with a list of files in the specified directory
|
|
FilesToArrayRecursive
|
Procedure
|
Recursively populates the passed array with a list of files in the specified directory plus all its subfolders
|
|
GetNamePart
|
Procedure
|
Returns the name and extension of a fully qualified file name
|
|
GetPathPart
|
Procedure
|
Returns the path part of a string
|
|
IsAttributeSet
|
Procedure
|
Determines if the specified attribute is set on the specified file.
|
|
KillFile
|
Procedure
|
Deletes the named file, handling errors if the file does not exist
|
|
MakeFolder
|
Procedure
|
Create a folder (directory) if it doesn't already exist.
The folder to create must be in a folder that already exists.
|
|
MakeSubFolders
|
Procedure
|
Create a folder (directory) and subfolders if it doesn't already exist
The basic MkDir command only creates a folder in a folder that already exists.
|
|
MoveFile
|
Procedure
|
Moves the specified file to a new destination.
If you use the VB Name function with the same file name for the source and destination arguments, but specify a different directory, the Name function actually moves the file. This procedure uses that behavior to move a file. Note that the destination file must not already exist. Use the FileExists function to determine if the file referenced by strDestination already exists. If so, delete it with the KillFile function.
|
|
ParsePath
|
Procedure
|
Parses the passed full path into its component parts
|
|
PurgeFile
|
Procedure
|
Replaces a file's contents with space characters for security.
When you a delete a DOS file (with the Kill command, or though the operating system or the DOS DEL command), its contents are not removed from the disk. Instead, the file is marked as deleted, and the contents remain on the disk until the space is needed by other files. This can lead to a potential security problem. To solve this, you must fill the file with blank contents, and the delete it. This function accomplishes that process.
|
|
ReadFileBytes
|
Procedure
|
Retrieve the specified number of bytes from a file (can be any type of file including binary and text files)
|
|
ReadFileContents
|
Procedure
|
Opens the named file and returns its contents as a variant
|
|
ReadFileText
|
Procedure
|
Read the specified number of characters from a text file
|
|
ReadTextFileToArray
|
Procedure
|
Reads a text file into an array of strings
|
|
RenameFile
|
Procedure
|
Rename a file or directory (folder)
|
|
SetFileAttributes
|
Procedure
|
Sets the specified attributes on the specified file
|