FileExists函數

用於檢查有無檔案。

格式
FileExists (檔名)

參數

檔案名稱
以字串指定要確認的檔案名稱。包括驅動器名稱和路徑名稱。僅指定檔名時,即指目前目錄中的檔案。詳細內容請參閱ChDisk。

注意


可使用網路路徑。


傳回值

  • 有檔案時:True
  • 沒有檔案時:False

參照
FolderExists、FileLen、FileDateTime$

FileExists函數範例

String myPath$
myPath$ = "c:\TEST\TEST.DAT"

If FileExists(myPath$) Then
    Print "Last access date and time: ", FileDateTime$(myPath$)
    Print "Size: ", FileLen(myPath$)
EndIf