Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
FileSystem Class

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
FileSystem Class

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 My.Computer.FileSystem Object.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Visual Basic (Declaration)
<StandardModuleAttribute> _
<SecurityPermissionAttribute(SecurityAction.LinkDemand, Unrestricted := True)> _
<HostProtectionAttribute(SecurityAction.LinkDemand, Resources := HostProtectionResource.ExternalProcessMgmt)> _
Public NotInheritable Class FileSystem
Visual Basic (Usage)
Dim instance As FileSystem
C#
[StandardModuleAttribute]
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)]
public sealed class FileSystem
Visual C++
[StandardModuleAttribute]
[SecurityPermissionAttribute(SecurityAction::LinkDemand, Unrestricted = true)]
[HostProtectionAttribute(SecurityAction::LinkDemand, Resources = HostProtectionResource::ExternalProcessMgmt)]
public ref class FileSystem sealed
JScript
public final class FileSystem
NoteNote:

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Resources. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

For more detailed information, see the Visual Basic topic FileSystem Module (Visual Basic).

This module supports the Visual Basic language keywords and run-time library members that access files and folders.

This example uses the GetAttr function to determine the attributes of a file and directory or folder.

Visual Basic
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

System..::.Object
  Microsoft.VisualBasic..::.FileSystem
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker