Results 1 to 5 of 5

Thread: Virtual folder

  1. #1

    Thread Starter
    Addicted Member BarankinBeAMan's Avatar
    Join Date
    Aug 2002
    Location
    Reston,Va
    Posts
    164

    Virtual folder

    I have a virtual folder with images like this: "../images/files/"
    I need to read the folder content, file names and count.
    How do I do that?

    Thank ya all!!

  2. #2
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    Tulsa,Ok
    Posts
    262

    Re: Virtual folder

    Take a look at the DirectoryInfo class and FileInfo class. THose would be the place to start. If you have any questions with them, let me know and I will help where I can.

  3. #3

    Thread Starter
    Addicted Member BarankinBeAMan's Avatar
    Join Date
    Aug 2002
    Location
    Reston,Va
    Posts
    164

    Re: Virtual folder

    how does that work in virtual directory?? "../folder/subfolder/../"

  4. #4
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: Virtual folder

    you would need to use Server.MapPath()

    VB Code:
    1. Dim PhysicalPath as String = Server.MapPath("../images/files/")
    2.  
    3. Dim di as New System.IO.DirectoryInfo(PhysicalPath)
    4.  
    5. 'Output a list of files
    6.  
    7. Dim Files() as System.IO.FileInfo = di.GetFiles()
    8.  
    9. Response.Write("<b> Files </b><br />")
    10.  
    11. For Each fi as FileInfo In Files
    12.     Response.Write(fi.Name & "<br />")
    13. Next
    14.  
    15. Dim Dirs() as System.IO.DirectoryInfo = Di.GetDirectories()
    16.  
    17. Response.Write("<b> Files </b><br />")
    18.  
    19. For Each d as DirectoryInfo In Dirs
    20.     Response.Write(d.Name & "<br />")
    21. Next

    Done of the top of my head, but should work fine....

    This lists all the files and then directories (if any exist)
    Last edited by <ABX; May 21st, 2005 at 04:12 PM.
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  5. #5

    Thread Starter
    Addicted Member BarankinBeAMan's Avatar
    Join Date
    Aug 2002
    Location
    Reston,Va
    Posts
    164

    Re: Virtual folder

    Perfect!
    Thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width