PDA

Click to See Complete Forum and Search --> : File size...


sTyLeZ
Mar 5th, 2001, 11:50 PM
Is there any *simple* way of getting a file's size, even if it is already open? I'm using this


Open f$ For Binary As #2
Size(J) = LOF(2)
Close #2


But, I get "Error 55: File already open" when it comes across files that are in use. I've looked at the GetFileSize and GetFileSizeEx API calls, and examples of how to use them, and I really don't wanna go through that much work just to get the file's size. I've also looked at GetFileAttributes, but that doesn't look any simpler. Any ideas?

Chris
Mar 6th, 2001, 04:28 AM
Ths can be done without any API function call.


Open "C:\pats.mdb" For Binary As #1
MsgBox "(From Open File) File size is : " & LOF(1) & " bytes"
Close #1

MsgBox "(using FileLen function and file is closed) File size is : " & FileLen("C:\pats.mdb") & "bytes"

sTyLeZ
Mar 6th, 2001, 07:53 AM
Thanks.