470,648 Members | 1,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

FileSystem Object - Iterating through a directory and building the path

Hi all ..

I have a directory with several subdirectories and a number of files in
each.
These files are accessed by going to a web page and clicking in a listbox
and navigating to the desired file.

Currently, when a new file is added to one of the sub directories, a new
link must be added to the web
page to add the new file to the listbox ... yes .... a very manually
intensive process!

I believe that I can replace this existing process with a dynamic one using
the File System Object but I could
use a little help thinking it through.

I need to display the file name (without the extention) in the listbox and I
need to build the path to the
file to be used as the Option Value in the listbox.

i.e.
<Option
value=file://servername/directory/subdirectory/subdirectory/subdirectory/fil
ename

I need two loops ... looping through the Folder Collection and through the
File collection. Do I nest them?
And how do I capture the path as it's building?

Thanks for any help and any direction !
- lise
Jul 19 '05 #1
1 5261
"Lise" <sc*******@snet.net> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
I believe that I can replace this existing process with a dynamic one using the File System Object but I could
use a little help thinking it through.

I need to display the file name (without the extention) in the listbox and I need to build the path to the
file to be used as the Option Value in the listbox.

i.e.
<Option
value=file://servername/directory/subdirectory/subdirectory/subdirectory/fil ename

I need two loops ... looping through the Folder Collection and through the
File collection. Do I nest them?
And how do I capture the path as it's building?


First, make sure you surround the option value with double quotes. As in:
<option value="...">

Next, you will probably want a function to handle the iteration, since you
want this to be dynamic. This function should take 1 or 2 parameters, the
path of the folder and perhaps a string to accumulate the filenames. This
function should create a FileSystemObject, then GetFolder of the path that
was passed in. Next, get the SubFolders. For Each subfolder in
foldercollection
' call the function again
Next
' Append the files in this folder to the input string (or print them if you
don't pass the string)

I wish I had time to go into more detail, but this is as much help as I can
be for now. Gotta run. Hope this helps some.
Regards,
Peter Foti


Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by stuart | last post: by
2 posts views Thread by Matthias | last post: by
4 posts views Thread by Ben Fidge | last post: by
8 posts views Thread by Daz | last post: by
1 post views Thread by mfsiddiq | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.