"Erik Ginnerskov" <erik.ginnerskov@live.dk> wrote in message
news:4b659168$0$278$14726298@news.sunsite.dk...
> Erik Ginnerskov wrote:
> Microsoft VBScript runtime error '800a004c'
> Path not found
> path/page.asp, line 35
>
> Linje 35:
> Set f = fs.GetFolder(Server.MapPath(sti))
Mon ikke det er fordi dyu mangler den der "/" ?
Jeg lavede den der test ud fra din kode (dog med jpg):
http://w-o-p-r.dk/gallery/deleteme.asp
Kildekoden er her:
<%
Response.write "<table summary=''>"
Sub GetSubFolderFile(sti,level)
  Dim strNySti, fs, f, files, fc, f1, f2
  if level > 0 then Response.Write "<tr><td>" & sti & "</td><td></td></tr>"
& vbcrlf
  If Right(sti,1) <> "/" Then
'    sti = sti + "/gamle_breve/"
  End if
  Set fs = Server.CreateObject("Scripting.FileSystemObject")
  Set f = fs.GetFolder(Server.MapPath(sti))
  Set files = f.Files
  For Each f2 in files
  If LCase(Right(f2.name, 3)) = "jpg" Then
  Response.Write "<tr><td><a class='tlink' href='"+sti+"/" & f2.name & "'>"
& f2.name & "</a>  </td>" &  _
    "<td>Ændret: " & f2.DateLastModified & "</td></tr>" & vbcrlf
  End If
  Next
  Set fc = f.SubFolders
  For Each f1 in fc
    strNySti =  sti & "/" & f1.name
    GetSubFolderFile strNySti,level+1
  Next
  Set fs = Nothing
  Set f = Nothing
  Set files = Nothing
  Set fc = Nothing
End Sub
GetSubFolderFile ".",0
Response.write "</table>"
%>
Du kan også få koden til mit sitemap, hvis det kan give lidt inspiration til
rekursive lister af filer/links:
<%@ LANGUAGE = VBScript %><%  Option Explicit     %><!--#include
virtual="/include_files/wopr.first.level.inc.asp"--><%
Dim ExcludeDirs
Dim ExcludeNames
Dim ExcludeTypes
Dim AsHTML
Dim AsXML
Dim AsRSS
Dim Host
Dim rootPath
Dim Weekdaynames
Dim Monthnames
Dim Startfolder
Dim ShowAll
   Host = "
http://"+ Request.Servervariables("HTTP_HOST")
%><!--#include virtual="/include_files/sitemap.exclude.inc.asp"--><%
   Response.ContentType="text/xml; charset=utf8"
   Weekdaynames = Array("Son","Mon","Tue","Wed","Thu","Fri","Sat")
   Monthnames   =
Array("Jan","Feb","Mar","Apr","May","Jun","Kil","Auf","Sep","Oct","Now","Dec
")
' prolog must be without any spaces
%><?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="
http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<%
rootPath = Server.MapPath("/")
ListFolderContents(Startfolder)
%></urlset>
<%
'****************************** Sub and Functions
******************************
sub ListFolderContents(path)
  ShowAll = false
  if Request.QueryString("showall") <> "" then ShowAll = true
     if Pathexcluded(path) then exit sub
     dim fs, folder, file, item, url
     set fs = CreateObject("Scripting.FileSystemObject")
     set folder = fs.GetFolder(path)
     'Display a list of sub folders.
     for each item in folder.SubFolders
       ListFolderContents(item.Path)
     next
    'Display a list of files.
     for each item in folder.Files
        if ShowThisFile (item.Name) then
           url = MapURL(item.path)
           url = Host + url
           %><url>
           <loc><% = url %></loc>
           <lastmod><%
'-------------- Skal laves, så den bruger dd. ved .ASP m.v. sider
           Response.Write cStr(DatePart("yyyy",Now())) + "-" + _
                          nn(DatePart("m",Now())) + "-" + _
                          nn(DatePart("d",Now()))
           %></lastmod>
           <changefreq>always</changefreq>
           </url>
              <%
        end if
     next
   end sub
'-----------------------------------------------------------------------
function MapURL(path)
     dim url
     'Convert a physical file path to a URL for hypertext links.
     url = Right(path, Len(path) - Len(rootPath))
     MapURL = Replace(url, "\", "/")
end function
'-----------------------------------------------------------------------
Function nn(inputnumber)
   if inputnumber > 9 then
      nn = cStr(inputnumber)
   else
      nn = "0" + cStr(inputnumber)
   end if
end function
'-----------------------------------------------------------------------
function Pathexcluded(path)
Dim i
   Pathexcluded = false
   if ShowAll then exit Function
   for i = 0 to uBound(ExcludeDirs)
      if inStr(lCase(path),ExcludeDirs(i)) then Pathexcluded = true
   next
end function
'-----------------------------------------------------------------------
function ShowThisFile(name)
Dim i
   ShowThisFile = true
   if ShowAll then exit Function
   for i = 0 to uBound(ExcludeNames)
      if inStr( lCase(name),ExcludeNames(i)) then ShowThisFile = false
   next
   for i = 0 to uBound(ExcludeTypes)
      if Right(lCase(name),len(ExcludeTypes(i))) = ExcludeTypes(i) then
ShowThisFile = false
   next
end function
'-----------------------------------------------------------------------
%>
--
Med venlig hilsen/Best regards
Stig Johansen