how do I get a file size

C

Chris

How do I find out the size of a file. I can get listing of files in a
directory but I cannot figure out how to get the file size also.

Here is what I have so far.
<%
Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set MyFiles=MyDirectory.GetFolder(Server.MapPath("test"))
For each filefound in MyFiles.files
Response.Write filefound.Name & "<br>"
Next
%>

I don't have any books for reference here. Can someone point out a good
online source?
 
S

Steven Burn

'For KB
Response.Write Format((filefound.Size / 1024), "###0.00") & " MB"

'For MB
Response.Write Format((filefound.Size / 1024) / 1024, "##0.00") & " MB"


--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top