...

View Full Version : Format of files in folder



ismilelots
08-08-2005, 11:47 PM
I got this script that will list all the files in my folder on my website and link to them. I was wondering how I can modify it to strip off the 1st 2 numbers in the name? (they are only there for my filing purposes and have nothing to do with the file name).
Maybe even replace them with an icon?

Your help would be greatly appreciated.


**** The Code ******
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder(Server.MapPath(Fldr))

Response.Write("<ul>")
For Each x In fo.files
If Right(x.Name,3)="pdf" Then
Response.Write("<li><a href=""" & Fldr & x.Name & """>" & Mid(x.Name,1,InStr(x.Name, ".")-1) & "</a></li>")
End If
Next
Response.Write("</ul>")

martin_narg
08-09-2005, 01:37 PM
Change this line:


Response.Write("<li><a href=""" & Fldr & x.Name & """>" & Mid(x.Name,1,InStr(x.Name, ".")-1) & "</a></li>")

To this:


'Response.Write("<li><a href=""" & Fldr & x.Name & """>" & Mid(x.Name, 3, Len(x.Name)-6) & "</a></li>")


Hope this helps

m_n

Bullschmidt
08-10-2005, 12:24 AM
And of course to have a file open in a new browser window you could add something like target='new' to the link... :)

ismilelots
08-10-2005, 01:37 AM
That worked great!! Thanks.
Now I understand the response line more too.

The open in new window idea is one I hadn't thought of, but is a GREAT idea.
Thanks alot.

Bullschmidt
08-10-2005, 01:42 AM
You're welcome and glad to hear it worked for you... :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum