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
 AppendAllTextAppend a text string to the end of a specified file using the supplied encoding. 
 AppendTextOpens a file to be written to starting at the end of the file. 
 CopyCopies a file. 
 CreateCreates a file. If the file already exists, it is overwritten. 
 CreateTextCreates a file using a UTF8Encoding. If the file already exists, then it is overwritten. 
 DeleteDeletes a file. 
 ExistsDetermines if a file exists. 
 GetAttributesReturns the file attributes (ReadOnly, Hidden, ...) 
 GetCreationTimeReturns the time the file was created in local time. 
 GetCreationTimeUtcReturns the time the file was created in UTC time. 
 GetLastAccessTimeReturns the time the file was accessed in local time. 
 GetLastAccessTimeUtcReturns The last time a file was accessed in UTC time. 
 GetLastWriteTimeReturns the last time the file was written to in local time. 
 GetLastWriteTimeUtcReturns the last time the file was written to in UTC time. 
 MoveMoves a file from one location to another. 
 OpenFileOpens a file with a FileStream 
 OpenReadOpens a file for reading as a FileStream. 
 OpenTextOpens a file for reading through a StreamReader. 
 OpenWriteOpens a file for writing as a FileStream. 
 ReadAllBytesReads an entire file into a byte array. 
 ReadAllLinesOpens a file, reads all lines in a file into an array and closes the files. 
 ReadAllTextReads the entire contents of a file and returns it as a String. 
 SetAttributesSets the file attributes (ReadOnly, Hidden, ...) 
 SetCreationTimeSets the time of creation for a file in local time. 
 SetCreationTimeUtcSets the time of creation for a file in UTC time. 
 SetLastAccessTimeSets the last time the file was accessed in local time. 
 SetLastAccessTimeUtcSets the last time the file was accessed in UTC time. 
 SetLastWriteTimeSets the last time the file was written to in local time. 
 SetLastWriteTimeUtcSets the last time the file was written to in UTC time. 
 WriteAllbytesOpens a file, writes all bytes to the file, then closes the file. 
 WriteAllLinesOpens a file, writes all strings to the file with appended new line values, then closes the file. 
 WriteAllTextOpens a files, writes out all contents to the file, then closes the file.