NetWare、Symbian OS、UNIX、Windows、および Windows CE で有効です。
GetFileTime 関数では、ファイルの作成日が返される(形式 1)か、または時間のタイプが指定されている場合(形式 2)は、作成日、最終アクセス日、または最終変更日が返されます。
ファイルの内容に関するこの関数の形式は、以下のとおりです。
GetFileTime(filename as String) as DateTime
GetFileTime(filename as String, type as Integer) as DateTime
調査するファイルの名前を指定します。
取得するファイル時間のタイプ。
有効な値は以下のとおりです。
0 作成日時。
1 最終アクセス日時。
2 最終変更日時(デフォルト)。
DateTime 構造体は以下のように定義されています。
Type DateTime
Year as Integer Month as Integer Day as Integer DayOfWeek as Integer Hour as Integer Minute as Integer Second as Integer
End Type
正常に終了した場合、この関数では、ファイルの作成日時(形式 1)か、または指定されているタイプの時間(形式 2)が返されます。 ファイルが存在しない場合、すべてのメンバに -1 が設定された DateTime 構造体が返されます。
例: GetFileTime 関数
この例では、ファイル AUTOEXEC.BAT のサイズと作成日がレポートされます。
dim size as integer
dim time as DateTime
dim out as string
size=GetFileSize("C:¥AUTOEXEC.BAT")
if (size<>-1) then
out="File size: "+chr(9)+chr(9)+str(size)+" bytes"+ chr(10)
time=GetFileTime("C:¥AUTOEXEC.BAT")
out=out+"Creation date: "+chr(9)+str(time.month)+"/"+str(time.day)+"/"+str(time.year)
out=out+" "+str(time.hour)+":"+str(time.minute)+" "
MsgBox("Information on C:¥AUTOEXEC.BAT"+chr(10)+chr(10)+out)
else
MsgBox("Cannot find C:¥AUTOEXEC.BAT")
end if
end:
|
Copyright © 2013 CA.
All rights reserved.
|
|