Application.FileSearch VBA Loop Through Folders

Discussion in 'VBA Developer' started by SVCitian, Jun 22, 2010.

  1. SVCitian

    SVCitian Guest

    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.
     
    SVCitian, Jun 22, 2010
    #1
    1. Advertisements

  2. 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?

    --
    ..NET: It's About Trust!
    http://vfred.mvps.org
     
    Karl E. Peterson, Jun 30, 2010
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Rick

    Application FileSearch Object

    Rick, Sep 2, 2003, in forum: VBA Developer
    Replies:
    4
    Views:
    263
    Wolfgang
    Sep 3, 2003
  2. TAT
    Replies:
    0
    Views:
    174
  3. JDB
    Replies:
    0
    Views:
    160
  4. StephenW
    Replies:
    3
    Views:
    684
    Karl E. Peterson
    Sep 13, 2007
  5. swvermeulen

    error Application.FileSearch.lookIn

    swvermeulen, Apr 22, 2008, in forum: VBA Developer
    Replies:
    0
    Views:
    212
    swvermeulen
    Apr 22, 2008
  6. Gilgamesh

    Application.FileSearch in 2007

    Gilgamesh, Jul 18, 2008, in forum: VBA Developer
    Replies:
    4
    Views:
    224
  7. kbaxreno

    application.filesearch replacement.

    kbaxreno, Oct 14, 2009, in forum: VBA Developer
    Replies:
    2
    Views:
    260
    Karl E. Peterson
    Oct 14, 2009
  8. Richard M. Hartman

    Application.FileSearch in VBA 2007

    Richard M. Hartman, May 14, 2010, in forum: VBA Developer
    Replies:
    2
    Views:
    869
    Richard M. Hartman
    May 14, 2010
Loading...