vmandem
asked on
How can I find the size of a file from the programme
I run a programme and it creates a file and I'm calling other procedures based on the file creation. I know how to check whether the file is created or not BUT I WANT TO KNOW THE FILE SIZE. IF THE FILE SIZE IS 1KB I DON'T WANT TO CALL ANY PROCEDURES FURTHER OTHERWISE I WANT TO. How to determine the file size which is sitting in one of my directories.
Thanks
vm
Thanks
vm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Imports System.IO
Public Class IO_Library
Public Shared Function FileSize(ByVal path As String) As Integer
Dim info As New FileInfo(path)
Return info.Length
End Function 'FileSize'
End Class 'IO_Library'
Usage:
Dim size As Integer = IO_Library.FileSize(path)
Bob
Public Class IO_Library
Public Shared Function FileSize(ByVal path As String) As Integer
Dim info As New FileInfo(path)
Return info.Length
End Function 'FileSize'
End Class 'IO_Library'
Usage:
Dim size As Integer = IO_Library.FileSize(path)
Bob
Ooh, too slow :(
Bob
Bob
I know the feeling... went to sleep for a few hours and all the good (well.. the questions I can answer) have all passed me by!
Dim filename as string
Dim fi As IO.FileInfo
filename="YourFileName"
fi=new IO.FileInfo(filename)
MessageBox.Show(fi.Length.
fi.Length contains the file size in bytes.
Hope this help
"Another rides the bus, and another one's on, and another one's on..." :)
Bob
Bob
I think there's an echo on this thread :P
ASKER
I thank every one for overwhelming responses. I Love EE.
Thanks Again.
vm
Thanks Again.
vm
Dim fLength As Integer = FileLen(myFileName)