Results 1 to 20 of 125

Thread: Combine recursive listing with excluded code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,899
    Location
    All I can say is ...


    1. This recursively goes down all the paths in Col A

        For i = LBound(aryPaths) To UBound(aryPaths)
            Call GetFiles(oFSO.GetFolder(RemovePrefix(aryPaths(i))))
        Next


    2. If the path is in Col C, then it stops going down that path

        If isFolderExcluded(oPath) Then Exit Sub  '   stops recursion
            
        Call AddFileFolder(oPath)


    3. If the file name is in Col E then it does NOT get added to the list

        For Each oFile In oPath.Files
            If Not isFileExcluded(oFile) Then Call AddFileFolder(oFile)
        Next

    4. So I'm not sure how to interpret this

    if I wanted the complete path for each specific folder or specific file to be excluded...
    Do you mean that if somewhere in the folder tree here's a file listed in Col E, then delete the entire folder tree?


    Edit:

    You can change

    Const incFilesFolders As Long = 10
    to

    Const incFilesFolders As Long = 100
    That tells Redim Preserve how many more spaces to allocate. I had it set low for testing, but might slow things down
    Last edited by Paul_Hossler; 05-10-2021 at 11:54 AM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •