共用方式為


FileSystem 模組 (Visual Basic)

更新:2007 年 11 月

FileSystem 模組會包含用於執行檔案、目錄或資料夾以及系統作業的程序。

My 功能在檔案 I/O 作業中的產能和效能勝過使用 FileSystem 模組。如需詳細資訊,請參閱 My.Computer.FileSystem 物件

備註

這個模組支援會存取檔案和資料夾的 Visual Basic 語言關鍵字和執行階段程式庫成員。

成員

ChDir

ChDrive

CurDir

Dir

EOF

FileAttr

FileClose

FileCopy

FileDateTime

FileGet

FileGetObject

FileLen

FileOpen

FilePut

FilePutObject

FileWidth

FreeFile

GetAttr

Input

InputString

Kill

LineInput

Loc

Lock

LOF

MkDir

Print

PrintLine

Rename

Reset

RmDir

Seek

SetAttr

SPC

TAB

Unlock

Write

WriteLine

 

 

範例

這個範例會使用 GetAttr 函式來判斷檔案和目錄或資料夾的屬性。

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

請參閱

參考

目錄和檔案摘要

輸入和輸出摘要

關鍵字和成員 (依工作分類)

Visual Basic 語言關鍵字

Visual Basic 執行階段程式庫成員

比較不同語言的關鍵字