File

File


Provides methods for manipulating and retrieving file information.

Remarks

This class cannot be directly created. To access the methods use the variable name directly.

 Debug.Print File.Exists("MyFile.txt")
 

See Also

Project VBCorLib Overview

Public:

Methods:

NameDescription
 AppendAllText Append a text string to the end of a specified file using the supplied encoding.  
 AppendText Opens a file to be written to starting at the end of the file.  
 Copy Copies a file.  
 Create Creates a file. If the file already exists, it is overwritten.  
 CreateText Creates a file using a UTF8Encoding. If the file already exists, then it is overwritten.  
 Delete Deletes a file.  
 Exists Determines if a file exists.  
 GetAttributes Returns the file attributes (ReadOnly, Hidden, ...)  
 GetCreationTime Returns the time the file was created in local time.  
 GetCreationTimeUtc Returns the time the file was created in UTC time.  
 GetLastAccessTime Returns the time the file was accessed in local time.  
 GetLastAccessTimeUtc Returns The last time a file was accessed in UTC time.  
 GetLastWriteTime Returns the last time the file was written to in local time.  
 GetLastWriteTimeUtc Returns the last time the file was written to in UTC time.  
 Move Moves a file from one location to another.  
 OpenFile Opens a file with a FileStream  
 OpenRead Opens a file for reading as a FileStream.  
 OpenText Opens a file for reading through a StreamReader.  
 OpenWrite Opens a file for writing as a FileStream.  
 ReadAllBytes Reads an entire file into a byte array.  
 ReadAllLines Opens a file, reads all lines in a file into an array and closes the files.  
 ReadAllText Reads the entire contents of a file and returns it as a String.  
 SetAttributes Sets the file attributes (ReadOnly, Hidden, ...)  
 SetCreationTime Sets the time of creation for a file in local time.  
 SetCreationTimeUtc Sets the time of creation for a file in UTC time.  
 SetLastAccessTime Sets the last time the file was accessed in local time.  
 SetLastAccessTimeUtc Sets the last time the file was accessed in UTC time.  
 SetLastWriteTime Sets the last time the file was written to in local time.  
 SetLastWriteTimeUtc Sets the last time the file was written to in UTC time.  
 WriteAllbytes Opens a file, writes all bytes to the file, then closes the file.  
 WriteAllLines Opens a file, writes all strings to the file with appended new line values, then closes the file.  
 WriteAllText Opens a files, writes out all contents to the file, then closes the file.