FileSystem Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides properties and methods for working with drives, files, and directories.
public ref class FileSystem
public class FileSystem
type FileSystem = class
Public Class FileSystem
- Inheritance
-
FileSystem
Examples
This example checks to determine whether the folder C:\backup\logs
exists and checks its properties.
Dim logInfo As System.IO.DirectoryInfo
If My.Computer.FileSystem.DirectoryExists("C:\backup\logs") Then
logInfo = My.Computer.FileSystem.GetDirectoryInfo(
"C:\backup\logs")
End If
Remarks
The following table lists examples of tasks involving the My.Computer.FileSystem
object.
Constructors
FileSystem() |
Initializes a new instance of the FileSystem class. |
Properties
CurrentDirectory |
Gets or sets the current directory. |
Drives |
Returns a read-only collection of all available drive names. |
Methods
CombinePath(String, String) |
Combines two paths and returns a properly formatted path. |
CopyDirectory(String, String, Boolean) |
Copies the contents of a directory to another directory. |
CopyDirectory(String, String, UIOption, UICancelOption) |
Copies the contents of a directory to another directory. |
CopyDirectory(String, String, UIOption) |
Copies the contents of a directory to another directory. |
CopyDirectory(String, String) |
Copies the contents of a directory to another directory. |
CopyFile(String, String, Boolean) |
Copies a file to a new location. |
CopyFile(String, String, UIOption, UICancelOption) |
Copies a file to a new location. |
CopyFile(String, String, UIOption) |
Copies a file to a new location. |
CopyFile(String, String) |
Copies a file to a new location. |
CreateDirectory(String) |
Creates a directory. |
DeleteDirectory(String, DeleteDirectoryOption) |
Deletes a directory. |
DeleteDirectory(String, UIOption, RecycleOption, UICancelOption) |
Deletes a directory. |
DeleteDirectory(String, UIOption, RecycleOption) |
Deletes a directory. |
DeleteFile(String, UIOption, RecycleOption, UICancelOption) |
Deletes a file. |
DeleteFile(String, UIOption, RecycleOption) |
Deletes a file. |
DeleteFile(String) |
Deletes a file. |
DirectoryExists(String) |
Returns |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
FileExists(String) |
Returns |
FindInFiles(String, String, Boolean, SearchOption, String[]) |
Returns a read-only collection of strings representing the names of files containing the specified text. |
FindInFiles(String, String, Boolean, SearchOption) |
Returns a read-only collection of strings representing the names of files containing the specified text. |
GetDirectories(String, SearchOption, String[]) |
Returns a collection of strings representing the path names of subdirectories within a directory. |
GetDirectories(String) |
Returns a collection of strings representing the path names of subdirectories within a directory. |
GetDirectoryInfo(String) |
Returns a DirectoryInfo object for the specified path. |
GetDriveInfo(String) |
Returns a DriveInfo object for the specified drive. |
GetFileInfo(String) |
Returns a FileInfo object for the specified file. |
GetFiles(String, SearchOption, String[]) |
Returns a read-only collection of strings representing the names of files within a directory. |
GetFiles(String) |
Returns a read-only collection of strings representing the names of files within a directory. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetName(String) |
Parses the file name out of the path provided. |
GetParentPath(String) |
Returns the parent path of the provided path. |
GetTempFileName() |
Creates a uniquely named zero-byte temporary file on disk and returns the full path of that file. |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
MoveDirectory(String, String, Boolean) |
Moves a directory from one location to another. |
MoveDirectory(String, String, UIOption, UICancelOption) |
Moves a directory from one location to another. |
MoveDirectory(String, String, UIOption) |
Moves a directory from one location to another. |
MoveDirectory(String, String) |
Moves a directory from one location to another. |
MoveFile(String, String, Boolean) |
Moves a file to a new location. |
MoveFile(String, String, UIOption, UICancelOption) |
Moves a file to a new location. |
MoveFile(String, String, UIOption) |
Moves a file to a new location. |
MoveFile(String, String) |
Moves a file to a new location. |
OpenTextFieldParser(String, Int32[]) |
The |
OpenTextFieldParser(String, String[]) |
The |
OpenTextFieldParser(String) |
The |
OpenTextFileReader(String, Encoding) |
Opens a StreamReader object to read from a file. |
OpenTextFileReader(String) |
Opens a StreamReader object to read from a file. |
OpenTextFileWriter(String, Boolean, Encoding) |
Opens a StreamWriter to write to the specified file. |
OpenTextFileWriter(String, Boolean) |
Opens a StreamWriter object to write to the specified file. |
ReadAllBytes(String) |
Returns the contents of a file as a byte array. |
ReadAllText(String, Encoding) |
Returns the contents of a text file as a |
ReadAllText(String) |
Returns the contents of a text file as a |
RenameDirectory(String, String) |
Renames a directory. |
RenameFile(String, String) |
Renames a file. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
WriteAllBytes(String, Byte[], Boolean) |
Writes data to a binary file. |
WriteAllText(String, String, Boolean, Encoding) |
Writes text to a file. |
WriteAllText(String, String, Boolean) |
Writes text to a file. |