Home All Groups Group Topic Archive Search About
Author
31 Jul 2006 9:13 AM
Vayse
Hi
I have to write a program that will list the contents of sub directories in
a directory.
These directories are for customer info. Layout like this

N:\FrenchCustomers\A\Cust1
N:\FrenchCustomers\A\Cust2
to
N:\FrenchCustomers\Z\Cust1

So FrenchCustomers, GermanCutomers etc will each have an A to Z
subdirectory.

My question is, whats the best way of stepping through these? Lets say I'm
just doing French customers.

FOLDER_NAME = "N:\FrenchCustomers\"
For stLetter = "A" to "Z"
        For Each foundDirectory In
My.Computer.FileSystem.GetDirectories(FOLDER_NAME & stLetter)
            Debug.Print(foundDirectory)
        Next
Next stLetter

Now, For stLetter = "A" to "Z"    won't work.
What should I do instead? I know I can it working by putting the letters in
a table, but that seems wasteful.
Whats the more efficient way?

Thanks
Vayse

Author
31 Jul 2006 11:34 AM
Kerry Moorman
Vayse,

For CharCode As Integer = 65 To 90
     FOLDER_NAME = "N:\FrenchCustomers\" & Chr(CharCode) & "\"
     etc

Kerry Moorman



Show quoteHide quote
"Vayse" wrote:

> Hi
> I have to write a program that will list the contents of sub directories in
> a directory.
> These directories are for customer info. Layout like this
>
> N:\FrenchCustomers\A\Cust1
> N:\FrenchCustomers\A\Cust2
> to
> N:\FrenchCustomers\Z\Cust1
>
> So FrenchCustomers, GermanCutomers etc will each have an A to Z
> subdirectory.
>
> My question is, whats the best way of stepping through these? Lets say I'm
> just doing French customers.
>
> FOLDER_NAME = "N:\FrenchCustomers\"
> For stLetter = "A" to "Z"
>         For Each foundDirectory In
> My.Computer.FileSystem.GetDirectories(FOLDER_NAME & stLetter)
>             Debug.Print(foundDirectory)
>         Next
> Next stLetter
>
> Now, For stLetter = "A" to "Z"    won't work.
> What should I do instead? I know I can it working by putting the letters in
> a table, but that seems wasteful.
> Whats the more efficient way?
>
> Thanks
> Vayse
>
>
>