Jump to content

Breaking Filename.name


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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...