Results 1 to 3 of 3

Thread: Directory/File Listing Problem

  1. #1
    rsitogp
    Guest

    Directory/File Listing Problem

    Hello,

    I was asked by a friend to make a prog that will create an html file with a directory/file listing every X seconds, I used the following code and it works fine if there's only one more level under the dir but if a sub dir has a sub dir it doesn't list it, any help would be greatfully apriciated
    Code:
    Text1.Text = "<html><title>Download Reporter</title><body>"
    For i = Dir1.ListIndex To Dir1.ListCount - 1
      sFile = Dir$(Dir1.List(i) & "\*.*")
      Text1.Text = Text1.Text & Dir1.List(i) & ": <br>"
      Do While sFile <> ""
        Text1.Text = Text1.Text & "<li>" & sFile & "</li><br>"
        sFile = Dir$
      Loop
      Text1.Text = Text1.Text & "<br>"
    Next i
    Open Text2.Text For Output As #1
    Print #1, Text1.Text
    Print #1, "<br><br><small>Created on: " & Date & " at: " & Time & "</body></html>"
    Close #1
    Thanks in advance!

  2. #2
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    yeah, it won't do any more than one level. You need to loop through your sub directories, getting the names of each file and storing them in an array (or writing them directly to your text box) - This shouldn't be a problem for your code, as you are building HTML on a hierarchical basis anyway...

  3. #3
    rsitogp
    Guest
    My question is how can I either check if a dir in a dir listbox has sub dirs and if so change to it (I can do this one) and carry on like this?

    Thanks in advance!

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