FileSystemObject 的集合與方法 來源:小恐龍

FileSystemObject 物件是執行所有檔案系統存取的最高層級物件, 他只有一個 Drives 集合, 主要作用為回傳 Drive 物件.

作用於磁碟裝置上的方法函式
方法函式內容說明
DriveExists(drive) 判定某磁碟是否存在
GetDrive(drive) 取得某檔案或資料夾所在磁碟的 Drive 物件
GetDriveName(drive) 取得某檔案或資料夾所在磁碟的名稱
作用於目錄資料夾上的方法函式
方法函式內容說明
BuildPath(path, name) 附加子目錄(資料夾)
CopyFolder(source, destination, overwrite) 複製資料夾
CreateFolder(pathandname) 建立新的資料夾
DeleteFolder(name, force) 刪除資料夾
FolderExists(name) 判定某資料夾是否存在
GetAbsolutePathName(path) 取得實體路徑
GetFolder(name) 取得實體路徑中的資料夾名稱
GetParentFolderName(name) 取得所指定檔案或資料夾的父資料夾名稱
GetSpecialFolder(name) 取得特殊資料夾的實體路徑
MoveFolder(source, destination) 搬移資料夾
作用於檔案上的方法函式
方法函式內容說明
CopyFile(source, destination, overwrite) 複製檔案
CreateTextFile(name, overwrite, unicode) 建立新的文字檔
DeleteFile(name, force) 刪除檔案
FileExists(name) 判定某檔案是否存在
GetBaseName(path) 取得路徑字串中最後一項的檔名
GetExtensionName(name) 取得某檔案的副檔名
GetFile(name) 取得某檔案對應到 File 物件
GetFileName(pathandname) 取得檔案路徑中最後的檔案全名
GetTempName() 取得暫存檔名
MoveFile(source, destination) 移動檔案
OpenTextFile(name, iomode, create, format) 開啟文字檔

小恐龍工作坊 提供