Listing SubFolders using FileSystemObject

Results 1 to 4 of 4

Thread: Listing SubFolders using FileSystemObject

  1. #1
    Jeff H. Guest

    Default Listing SubFolders using FileSystemObject

    I can list files easily, but i can&#039t seem to list subdirectories.<BR><BR>i looked in MSDN&#039s VBScript files, but they don&#039t give very good examples.<BR><BR>Mahalo.

  2. #2
    Rob Speicher Guest

    Default RE: Listing SubFolders using FileSystemObject

    Set fs = CreateObject("Scripting.FileSystemObject")<BR> Set f = fs.GetFolder(Server.MapPath(Mp3Dir))<BR> Set fc = f.Files<BR> Set subf = f.SubFolders<BR><BR> for each folder in subf<BR>%&#062;<BR> &#060;%= folder.Name %&#062;<BR><BR>&#060;% Next %&#062;<BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    653

    Default RE: Listing SubFolders using FileSystemObject

    after some tweaking, i got this to work:<BR><BR>strPathInfo = Request.ServerVariables("Path_Info")<BR>strPhysica lPath = Server.MapPath(strPathInfo)<BR>Set objFSO = CreateObject("Scripting.FileSystemObject")<BR>Set objFile = objFSO.GetFile(strPhysicalPath)<BR>Set objFolder = objFile.ParentFolder<BR>Set objSubfolder = objFolder.SubFolders<BR>Set objFolderContents = objFolder.Subfolders<BR><BR>it lists all the folders, but it also lists their physical path. how can i get just their names?<BR><BR>i.e. d:/html/folder_1 --&#062; folder_1

  4. #4
    Join Date
    Dec 1969
    Posts
    653

    Default RE: Listing SubFolders using FileSystemObject

    after some tweaking, i got this to work:<BR><BR>strPathInfo = Request.ServerVariables("Path_Info")<BR>strPhysica lPath = Server.MapPath(strPathInfo)<BR>Set objFSO = CreateObject("Scripting.FileSystemObject")<BR>Set objFile = objFSO.GetFile(strPhysicalPath)<BR>Set objFolder = objFile.ParentFolder<BR>Set objSubfolder = objFolder.SubFolders<BR>Set objFolderContents = objFolder.Subfolders<BR><BR>it lists all the folders, but it also lists their physical path. how can i get just their names?<BR><BR>i.e. d:/html/folder_1 --&#062; folder_1


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •