Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Who can help me get a bug out of this script 3

Status
Not open for further replies.

Nogi

Technical User
Dec 10, 2004
132
BE
I'm not a script-writer at all, but found this script on the net, that should do exactly what i was searching for:

What it does is showing the files inside a particular folder, as a link (or that's at least, that's what was said).

However, i can't seem to get it to work since i keep on receiving an "expected statement" error.

I hope somebody can help me with this.

This is the code:

<%Option Explicit Const IISFOLDER = "/Partitions/Joucomatic"%>
<%
Dim fso, folder, File, Files, sFileDetails
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(IISFOLDER)
Set Files = folder.Files
For Each File in Files
'--Only show files with constant file extensions
sFileDetails = "<b>File Name: " & File.name & "</b><br>" & _
"Date Created: " & File.DateCreated & "<br>" & _
"Date Date Last Accessed: " & File.DateLastAccessed & "<br>" & _
"Last Modified Date: " & File.DateLastModified & "<br>" & _
"Type: " & File.Type & "<br>" & _ "Path: " & File.Path & "<br>" & _
"Time From Creation: " & DateDiff("n",File.DateCreated,Now) & "minutes" & "<br>" & _
"Time From Modification: " & DateDiff("n",File.DateLastModified,Now) & " minutes" & "<br>" & _
"Time From Access: " & DateDiff("n",File.DateLastAccessed,Now) & " minutes" & "<hr>"
Response.Write sFileDetails
Next
Set folder = Nothing
Set fso = Nothing
%>
</body>
</html>

Thanks in advance for your help.
 
it looks like this line is accidently repeated:
For Each File in Files
 
whoops, and i left out a "greater than" ...

<a href = '/Partitions/Joucomatic/<%= File.Name %> [highlight]>[/highlight]'
 
i guess i'm starting to confuse you all a bit.

The idea is the following:

I have for instance a folder called Joucomatic.
That folder contains several files, for example "instructions.pdf" and "certificates.pdf" and "start.pdf" etc.

The idea is just to have a page, that does nothing but show the filenames in a simple list, and shows them as links to their particular files in the folder.
So the filename "instructions.pdf" on the page, will contain a link to the file "instructions.pdf" in the joucomatic folder.
The same for start.pdf and certificates and so on.

I will use this page in about 50 or 60 different folders, so therefore it was interesting if the page was generated automatically in each folder.
 
whoops again, the quote should be before the greater than:
<a href = '/Partitions/Joucomatic/<%= File.Name %>' >
 
Alright then you'll need to use a variable instead of the hard-coded /Partitions/Joucomat/
 
If that is possible i'll come over there and kiss you instead. (i'm a guy though, so that's probably a big efford).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top