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.
The FileSystem
module contains the procedures that are used to perform file, directory or folder, and system operations. The My
feature gives you better productivity and performance in file I/O operations than using the FileSystem
module. For more information, see FileSystem.
public ref class FileSystem sealed
[Microsoft.VisualBasic.CompilerServices.StandardModule]
public sealed class FileSystem
[Microsoft.VisualBasic.CompilerServices.StandardModule]
[System.Security.SecurityCritical]
public sealed class FileSystem
[<Microsoft.VisualBasic.CompilerServices.StandardModule>]
type FileSystem = class
[<Microsoft.VisualBasic.CompilerServices.StandardModule>]
[<System.Security.SecurityCritical>]
type FileSystem = class
Public Module FileSystem
- Inheritance
-
FileSystem
- Attributes
Examples
This example uses the GetAttr
function to determine the attributes of a file and directory or folder.
Dim MyAttr As FileAttribute
' Assume file TESTFILE is normal and readonly.
MyAttr = GetAttr("C:\TESTFILE.txt") ' Returns vbNormal.
' Test for normal.
If (MyAttr And FileAttribute.Normal) = FileAttribute.Normal Then
MsgBox("This file is normal.")
End If
' Test for normal and readonly.
Dim normalReadonly As FileAttribute
normalReadonly = FileAttribute.Normal Or FileAttribute.ReadOnly
If (MyAttr And normalReadonly) = normalReadonly Then
MsgBox("This file is normal and readonly.")
End If
' Assume MYDIR is a directory or folder.
MyAttr = GetAttr("C:\MYDIR")
If (MyAttr And FileAttribute.Directory) = FileAttribute.Directory Then
MsgBox("MYDIR is a directory")
End If
Remarks
This module supports the Visual Basic language keywords and run-time library members that access files and folders.
Methods
ChDir(String) |
Changes the current directory or folder. The |
ChDrive(Char) |
Changes the current drive. |
ChDrive(String) |
Changes the current drive. |
CurDir() |
Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than |
CurDir(Char) |
Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than |
Dir() |
Returns a string representing the name of a file, directory, or folder that matches a specified pattern or file attribute, or the volume label of a drive. The FileSystem gives you better productivity and performance in file I/O operations than the |
Dir(String, FileAttribute) |
Returns a string representing the name of a file, directory, or folder that matches a specified pattern or file attribute, or the volume label of a drive. The FileSystem gives you better productivity and performance in file I/O operations than the |
EOF(Int32) |
Returns a Boolean value |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
FileAttr(Int32) |
Returns an enumeration representing the file mode for files opened using the |
FileClose(Int32[]) |
Concludes input/output (I/O) to a file opened using the |
FileCopy(String, String) |
Copies a file. The FileSystem gives you better productivity and performance in file I/O operations than |
FileDateTime(String) |
Returns a |
FileGet(Int32, Array, Int64, Boolean, Boolean) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Boolean, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Byte, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Char, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, DateTime, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Decimal, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Double, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Int16, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Int32, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Int64, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, Single, Int64) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, String, Int64, Boolean) |
Reads data from an open disk file into a variable. The |
FileGet(Int32, ValueType, Int64) |
Reads data from an open disk file into a variable. The |
FileGetObject(Int32, Object, Int64) |
Reads data from an open disk file into a variable. The |
FileLen(String) |
Returns a value that specifies the length of a file in bytes. The |
FileOpen(Int32, String, OpenMode, OpenAccess, OpenShare, Int32) |
Opens a file for input or output. The |
FilePut(Int32, Array, Int64, Boolean, Boolean) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Boolean, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Byte, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Char, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, DateTime, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Decimal, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Double, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Int16, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Int32, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Int64, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, Single, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Int32, String, Int64, Boolean) |
Writes data from a variable to a disk file. The |
FilePut(Int32, ValueType, Int64) |
Writes data from a variable to a disk file. The |
FilePut(Object, Object, Object) |
Obsolete.
Obsolete.
Obsolete.
Writes data from a variable to a disk file. The |
FilePutObject(Int32, Object, Int64) |
Writes data from a variable to a disk file. The |
FileWidth(Int32, Int32) |
Assigns an output line width to a file opened by using the |
FreeFile() |
Returns an |
GetAttr(String) |
Returns a |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
Input(Int32, Boolean) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Byte) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Char) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, DateTime) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Decimal) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Double) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Int16) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Int32) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Int64) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Object) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, Single) |
Reads data from an open sequential file and assigns the data to variables. |
Input(Int32, String) |
Reads data from an open sequential file and assigns the data to variables. |
InputString(Int32, Int32) |
Returns |
Kill(String) |
Deletes files from a disk. The |
LineInput(Int32) |
Reads a single line from an open sequential file and assigns it to a |
Loc(Int32) |
Returns a value that specifies the current read/write position in an open file. |
Lock(Int32, Int64, Int64) |
Controls access by other processes to all or part of a file opened by using the |
Lock(Int32, Int64) |
Controls access by other processes to all or part of a file opened by using the |
Lock(Int32) |
Controls access by other processes to all or part of a file opened by using the |
LOF(Int32) |
Returns the size, in bytes, of a file opened by using the |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
MkDir(String) |
Creates a new directory. The |
Print(Int32, Object[]) |
Writes display-formatted data to a sequential file. |
PrintLine(Int32, Object[]) |
Writes display-formatted data to a sequential file. |
Rename(String, String) |
Renames a disk file or directory. The |
Reset() |
Closes all disk files opened by using the |
RmDir(String) |
Removes an existing directory. The |
Seek(Int32, Int64) |
Returns a |
Seek(Int32) |
Returns a |
SetAttr(String, FileAttribute) |
Sets attribute information for a file. The |
SPC(Int16) |
Used with the |
TAB() |
Used with the |
TAB(Int16) |
Used with the |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Unlock(Int32, Int64, Int64) |
Controls access by other processes to all or part of a file opened by using the |
Unlock(Int32, Int64) |
Controls access by other processes to all or part of a file opened by using the |
Unlock(Int32) |
Controls access by other processes to all or part of a file opened by using the |
Write(Int32, Object[]) |
Writes data to a sequential file. Data written with |
WriteLine(Int32, Object[]) |
Writes data to a sequential file. Data written with |