File 物件的屬性與方法 來源:小恐龍

File 物件代表網路分享資源或本地機器上的檔案, 透過此物件, 將可以存取檔案的相關內容

File 物件的屬性
屬性內容說明
Attributes 取得檔案屬性(Normal(0), ReadOnly(1), Hidden(2), System(4), Volume(name)(8), Directory(folder)(16), Archive(32), Alias(64), Compressed(128)
DateCreated 取得檔案建立日期
DateLastAccessed 該檔案最近存取日期
DateLastModified 該檔案最近修改日期
Drive 檔案所在磁碟的字母代號
Name 檔案名稱
ParentFolder 傳回目前檔案所位於的資料夾名稱
Path 回傳檔案完整實體路徑
ShortName 傳回 DOS 8.3 格式檔案名稱
ShortPath 傳回 DOS 8.3 格式實體路徑
Size 目前檔案大小
Type 傳回目前檔案類型
File 物件的方法函式
方法函式內容說明
Copy(destination, overwrite) 複製檔案
Delete(force) 刪除檔案
Move(destination) 搬移檔案
CreateTextFile(name, overwrite, unicode) 建立新的文字檔
OpenAsTextStream(iomode, format) 開啟檔案(1-讀, 2-寫, 8-附加)

小恐龍工作坊 提供