Application.FileSearch VBA Loop Through Folders

S

SVCitian

Hello,

I want help.. I have seen help files but couldn't make heads or tails
of the ScopeFolder and SearchScopes methods

Totally confused.

What I want to do is:

I want to loop through the Root Directory... in the first 5 folders
only... with fixed names..

C:\bdt1 <--
C:\xbd2 <--
C:\bbb3 <--
C:\ggg4 <--
C:\ttt5 <--
C:\xxx1
C:\xxx2


and then search in C:\first5folders[ ]\2010\05 for Excel Files.

To achieve this... I want to Add just The 5 folders.. .and search for
Excel Files in there...

C:\bdt1\2010\05
C:\xbd2\2010\05
C:\bbb3\2010\05
C:\ggg4\2010\05
C:\ttt5\2010\05

Since there are 10s of thousand of files and folders... in the C:
\Folder[1to5].. I thought this is the fastest option to go through
just the folders that I want in the format YYYY\MM\[every sub folder
under here and look for Excel Files]

I don't know how to achieve this.... I think i need to add these
folders in search scopes or something... which I have no clue.. how to
do it...

Please help.

I have achieved it through using wildcard pattern in path names... but
I prefer to do it more elegantly.
 
K

Karl E. Peterson

SVCitian wrote on 6/22/2010 :
Hello,

I want help.. I have seen help files but couldn't make heads or tails
of the ScopeFolder and SearchScopes methods

Totally confused.

What I want to do is:

I want to loop through the Root Directory... in the first 5 folders
only... with fixed names..

C:\bdt1 <--
C:\xbd2 <--
C:\bbb3 <--
C:\ggg4 <--
C:\ttt5 <--
C:\xxx1
C:\xxx2


and then search in C:\first5folders[ ]\2010\05 for Excel Files.

To achieve this... I want to Add just The 5 folders.. .and search for
Excel Files in there...

C:\bdt1\2010\05
C:\xbd2\2010\05
C:\bbb3\2010\05
C:\ggg4\2010\05
C:\ttt5\2010\05

Since there are 10s of thousand of files and folders... in the C:
\Folder[1to5].. I thought this is the fastest option to go through
just the folders that I want in the format YYYY\MM\[every sub folder
under here and look for Excel Files]

I don't know how to achieve this.... I think i need to add these
folders in search scopes or something... which I have no clue.. how to
do it...

Please help.

I have achieved it through using wildcard pattern in path names... but
I prefer to do it more elegantly.

Well, it's still unclear to me what exactly you're asking. If you have
a list of 5 search paths, the easiest, most elegant way to search each
of them is one at a time. What am I missing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top