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