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. Advertising

  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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    101
    Douglas J. Steele
    Jan 4, 2008
  2. Roger Frye

    VBA Application.FileSearch

    Roger Frye, Mar 5, 2004, in forum: Excel Programming
    Replies:
    0
    Views:
    96
    Roger Frye
    Mar 5, 2004
  3. TAT
    Replies:
    1
    Views:
    71
    JackD
    Oct 6, 2004
  4. Nancy22

    Application.FileSearch in Word2007 VBA

    Nancy22, Aug 22, 2008, in forum: Word Programming
    Replies:
    1
    Views:
    378
    Jay Freedman
    Aug 23, 2008
  5. Crustysquirrel

    Application.FileSearch on only one level of sub folders

    Crustysquirrel, Aug 2, 2005, in forum: Excel Programming
    Replies:
    3
    Views:
    100
    NickHK
    Aug 3, 2005
Loading...

Share This Page