Get file size for big files (1 Viewer)

dannewestis

Registered User.
Local time
Today, 07:04
Joined
Sep 15, 2006
Messages
12
I'm trying to get the file size of files that can be up to 8GB. filelen() only works up to 2GB, as bigger files than that returns a negative value.

I understand there are methods to retrive the correct file size for files bigger than 2GB, but I haven't quite understood how it works... especially if the files are even bigger than 4GB.

Can someone please share an easily-understandable way of getting the correct file size for such bug files?

Thanks!

/Daniel
 

wazz

Super Moderator
Local time
Today, 14:04
Joined
Jun 29, 2004
Messages
1,711
Code:
Public Function ShowFileInfo2(filespec)
    Dim fs, f, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    s = f.Size  'DateCreated
    MsgBox s
End Function
- you can use the FileSystemObject to get info about files and folders (file system). look up FileSystemObject or File Object (and many related topics) in vba help.
- filespec = path to your file.
 

dannewestis

Registered User.
Local time
Today, 07:04
Joined
Sep 15, 2006
Messages
12
Works great. Thank you! :)
 

Users who are viewing this thread

Top Bottom