|
|
Title | See if a file exists and get the time it was last modified |
Keywords | file, exists, time, modified |
Categories | Files and Directories |
|
|
Use GetAttr to see if the file exists. Use FileDateTime to get the time it was created or last modified.
Thanks to Phil McCarthy
|
|
Private Sub Command1_Click()
b$ = Text1.Text
On Error GoTo filenotfound
a$ = GetAttr(b$)
Label1.Caption = "file exists"
Exit Sub
filenotfound:
Label1.Caption = "file does not exist"
End Sub
Private Sub Command2_Click()
b$ = Text1.Text
On Error GoTo filenotfound
a$ = FileDateTime(b$)
Label1.Caption = a$
Exit Sub
filenotfound:
Label1.Caption = " Not a valid path or file"
End Sub
Private Sub Form_Load()
file_name = App.Path
If Right$(file_name, 1) <> "\" Then file_name = _
file_name & "\"
file_name = file_name & "FileTim4.frm"
Text1.Text = file_name
End Sub
|
|
Formatted by
Neil Crosby
|
|
|
|
|
|