Forum Moderators: open

Message Too Old, No Replies

IIS Directory Listing - File size?

         

furman

10:12 am on Oct 18, 2003 (gmt 0)

10+ Year Member



Hi,
I searched through google and found this post in this forum:
[webmasterworld.com...]

I got it working first time :)

Is there an asp code to show the file size of each file displayed?

This is my code - exactly the same as in the post:
--
<%
Dim objFSO, objFile
Dim sMapPath, objFolder

'Create File System Object to get list of files
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Get The path for the web page and its dir, change this setting to

view different directories!
sMapPath = server.mapPath("./.") ' this means the current directory

'Set the object folder to the mapped path
Set objFolder = objFSO.GetFolder(sMapPath)
' Then for each file in the object we loop through and print the file

and when it was last modified
For Each objFile in objFolder.Files

' Print out a link to the file
Response.Write "<tr><td><a href=""nasheeds/&objFile.Name&"">"
Response.write objFile.Name &" </a></td><td> "&

objFile.DateLastModified ' the file name and its date
Response.write "</td><br></tr>" ' close the tags
Next ' Loop back

' Clear the objects
Set objFSO = Nothing
Set objFolder = Nothing

%>
--
I am not too keen on programming but I really wanted something simple to implement and this worked first time :)

mattglet

1:33 pm on Oct 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



objFile.size

-Matt