Intermediate Page Two
To find out the size of a file, in bytes, use the FileLen() function. Here's an example:
-- Mysterious AppMan's younger brother, Colin.
Did you know Visual Basic provides complete support for all basic file operations? Here's my top three file handling code snippets:
Copy a File:
Delete a File
Move a File
Name "c:\oldfile.txt" as "c:\newfile.txt"
Hah, who needs the API?
-- Danny Weidman, Cardiff.
Get a File Date and Time
You can use the FileDateTime() function to retrieve details of when a file was last modified.
-- David Homer, Canada.
Check if a File Exists
Here's a groovy little function I wrote to check whether a file actually exists:
Public Function FileExists(FileName As String) As Boolean If Dir(FileName) = "" Then FileExists = False Else FileExists = True End IfEnd Function
You use it like this:
If FileExists("c:\nofilehere.txt") = False Then _MsgBox ("File does not exist!")
-- Barry Manilow, Copacobana (North of Havana).
Page 3 of 4