Print Page | Close Window

FSO - Get folder names

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=8855
Printed Date: 01 April 2026 at 12:59am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: FSO - Get folder names
Posted By: Semikolon
Subject: FSO - Get folder names
Date Posted: 13 January 2004 at 1:21pm

yo..

i have this code for getting file names:

Function SkinSelect(strType)  'Link - Textlinks, Drop - Dropdown list

 Response.Write("<div align=""center"">")
 
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFolder = objFSO.GetFolder(Server.MapPath("skin_files\"))

  intNumOfSkins = CInt((objFolder.Files.Count - 1) / 2)

  If intNumOfSkins = 1 Then Response.Write(intNumOfSkins & strTxtSkinInstalled & ".") Else Response.Write(intNumOfSkins & strTxtSkinsInstalled & ".")

  If intNumOfSkins > "0" Then

   If strType = "Drop" Then

    Response.Write("<br />")
    Response.Write("<select size=""1"" name=""skin"">")
    Response.Write("<option selected>---" & strTxtSelectSkin & "---</option>")

    For Each objFile In objFolder.Files

     If Right(objFile.Name, 5) = ".skin" Then

      Set objTextStream = objFSO.OpenTextFile(Server.MapPath("skin_files\" & objFile.Name))
      objTextStream.ReadLine

      Response.Write("<opti on value=""" & objFSO.GetBaseName(objFile) & """>")
      Response.Write(objTextSt ream.ReadLine)
      Response.Write("</opt ion>")

      objTextStream.Close
      Set objTextStream = Nothing
     
     End If

    Next

    Response.Write("</select>")

   ElseIf strType = "Link" Then

    Response.Write("<br />")

    For Each objFile In objFolder.Files

     If Right(objFile.Name, 5) = ".skin" Then

      Set objTextStream = objFSO.OpenTextFile(Server.MapPath("skin_files\" & objFile.Name))
      objTextStream.ReadLine

      Response.Write("-<a href=" & Request.ServerVariables("URL") & "?Skin=" & objFSO.GetBaseName(objFile) & ">")
      Response.Write(objTextSt ream.ReadLine)
      Response.Write("</a&g t;-<br />")

      objTextStream.Close
      Set objTextStream = Nothing
     
     End If

    Next

   End If

  End If

  Set objFolder = Nothing
  Set objFSO = Nothing

 Response.Write("</div>")
 
End Function

 

what i wanted to knwo, how can i get the folder names the same way? (what should i use instead of objFolder.Files?

 

sorry if this have been answered here before, but i couldnt manage to find it..




Replies:
Posted By: KCWebMonkey
Date Posted: 13 January 2004 at 1:50pm
http://www.w3schools.com/asp/asp_ref_folder.asp - http://www.w3schools.com/asp/asp_ref_folder.asp


Posted By: Semikolon
Date Posted: 13 January 2004 at 1:54pm

oh.. ive missed that tutorial!

thanks KC




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net