Obtaining Folder properties

B

Bill

I'm designing some reports which require the folder size &
number of files in a folder. How would this be best done
within Access 2000 running on a W2K machine? TIA
 
A

Alex Dybenko

you can use DIR function to count number of files and FileLen function to
get filesize of each file
 
D

Dev Ashish

I'm designing some reports which require the folder size &
number of files in a folder. How would this be best done
within Access 2000 running on a W2K machine? TIA

Here's a test routine to followup on Alex's suggestion.

Sub TestDirSize()
Const FOLDER = "C:\Temp\"
Dim tmp As String
Dim size As Long, count As Integer

tmp = Dir$(FOLDER & "*.*")
Do While Len(tmp) > 0
count = count + 1
size = size + FileLen(FOLDER & tmp)
tmp = Dir
Loop
MsgBox "Count: " & count & vbCrLf & _
"Size: " & size
End Sub

-- Dev
 
G

Guest

Works like a charm. Thanks
-----Original Message-----


Here's a test routine to followup on Alex's suggestion.

Sub TestDirSize()
Const FOLDER = "C:\Temp\"
Dim tmp As String
Dim size As Long, count As Integer

tmp = Dir$(FOLDER & "*.*")
Do While Len(tmp) > 0
count = count + 1
size = size + FileLen(FOLDER & tmp)
tmp = Dir
Loop
MsgBox "Count: " & count & vbCrLf & _
"Size: " & size
End Sub

-- Dev
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top