Natya
May 23rd, 2001, 09:21 AM
How do I determine the size of any file in a certain directory? (In VB 6.0)
|
Click to See Complete Forum and Search --> : Determining file size in VB Natya May 23rd, 2001, 09:21 AM How do I determine the size of any file in a certain directory? (In VB 6.0) dfwade May 23rd, 2001, 09:25 AM the filelen(filename) function will give up the size of the file filedatetime will give the date and time last modified. Cimperiali May 23rd, 2001, 09:33 AM '1 filelistbox '1 command button 'select a file from file list box, then click on command button Option Explicit Private Sub Command1_Click() Dim lngFileSize As Long lngFileSize = FileLen(File1.FileName) MsgBox "File Size: " & Format(lngFileSize, "###,###,### bytes") End Sub Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. shree May 23rd, 2001, 09:41 AM If it's an open file, you can use the LOF() function open "test.txt" for binary as #1 msgbox LOF(1) close #1 Iouri May 23rd, 2001, 09:57 AM Dim filesys,f As Object Set filesys = CreateObject("Scripting.FileSystemObject") Set f = filesys.GetFolder(folderpath) Msgbox f.Size Iouri Boutchkine iouri@hotsheet.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |