Jump to content

Breaking Filename.name


madsovenielsen
 Share

Recommended Posts

Hey all.

<%dim FileSystem, FolderContentSet FileSystem = Server.CreateObject("Scripting.FileSystemObject")Set FolderContent = fileSystem.GetFolder("C:\")For Each fileName in folderContent.FilesResponse.Write("<tr><td>" & fileName.Name & "</td></tr>")Next%>

I want to populate a table with the output of fileName.NameThis populates the table fine. but if i want to add more columns i get a problem, all the columns will get the same value except for filename. i understand why, how do i response.write one filename at a time. ?/mads

Edited by madsovenielsen
Link to comment
Share on other sites

You need to be more specific, I'm not sure what you're asking. You are writing one filename at a time.
Sorry about that. Yes im writing one filename at a time. but i want to add more td´s to the table with the file type and size etc.
<%'**************Project Name********************'**********************************************dim fs,pset fs = Server.CreateObject("Scripting.FileSystemObject")set p = fs.getfile("C:\test.tmp")set fs = nothing'***********Get project content****************Dim fq, f, fc  Set fq = CreateObject("Scripting.FileSystemObject") Set f = fq.GetFolder("C:\")Set fc = f.files '**********************************************   		For Each f1 in fc			Response.write("<tr><td>" & f1.name & "</td>" & "<td>" & "Version" & "</td>" & "<td>" & p.type & "</td>" & "<td>" & p.size & " Byte" & "</td>" & "<td>" & p.DateLastModified & "</td>" & "<td>" & p.path & "</td>" & "<td>" & "Status" & "</td>" & "</tr>")		next%>

I need set p = fs.getfile to change according to the files in the folder. so i can response.write the file properties in a tableExample:Filename1 938 Byte HTMLFilename2 748 Byte XMLFilename3 367 Byte ASPEtc...Hope it clears things up :)

Link to comment
Share on other sites

You're not setting p to anything inside the loop, so it's always going to print the same information. If you want the information to change then you need to redefine p inside the loop so that it points to the current file, or those properties might also be in f1.

Link to comment
Share on other sites

You're not setting p to anything inside the loop, so it's always going to print the same information. If you want the information to change then you need to redefine p inside the loop so that it points to the current file, or those properties might also be in f1.
Thanks that did the job. :)f1.name, f1.type etc.Great succes!/mads
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...