+ Reply to Thread
Results 1 to 7 of 7

VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

  1. #1
    Registered User
    Join Date
    12-27-2018
    Location
    London, England
    MS-Off Ver
    2007, 2010
    Posts
    39

    VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    If any part of filename has text say "app" in multiple child subfolders inside "myfolder1" then copy all those files with "originsubfoldername_existingname.txt" in "folderX".

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    Is this a description of the situation as in the image ?
    Attached Images Attached Images

  3. #3
    Registered User
    Join Date
    12-27-2018
    Location
    London, England
    MS-Off Ver
    2007, 2010
    Posts
    39

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    Yes!
    Again myfolder1_child3 may have child folders myfolder2_child-x and
    myfolder2_child-x may have child folders myfolder3_child-y.

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    However, your answer means "no":

    1. What if some subsequent child directory will be named as one of the earlier directories and the file names will be the same (?), then the files will overwriting each other, e.g.:

    \myfolder1\myfolder1-child3\myfolder1-child3_folder1

    , where e.g.: myfolder1 = "A", myfolder1-child3 = "AB", myfolder1-child3_folder1 = "AB", then:

    \A\AB\AB

    see attachment

    2. Present an example layout / nesting of such directories that may appear at your place
    Attached Files Attached Files
    Last edited by mjr veverka; 12-24-2019 at 08:35 AM.

  5. #5
    Registered User
    Join Date
    12-27-2018
    Location
    London, England
    MS-Off Ver
    2007, 2010
    Posts
    39

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    All folder names are different. If the same foldername.filename appaers we can use number like foldername.filename_1, foldername.filename_2.

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,150

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    Try:
    Please Login or Register  to view this content.
    Macro call, e.g.:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-27-2018
    Location
    London, England
    MS-Off Ver
    2007, 2010
    Posts
    39

    Re: VBA: Copy text file in child subfolders as originsubfoldername_existingname.txt

    "mainfolder" issue saying type mismatch.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy file and paste it in main folder and its subfolders recpectively
    By fabian_76 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-27-2018, 05:33 PM
  2. [SOLVED] Count and copy subfolders and modify a TXT file
    By Andrew Entee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2017, 02:18 PM
  3. Replies: 4
    Last Post: 10-21-2016, 05:33 PM
  4. Replies: 1
    Last Post: 10-19-2016, 04:44 PM
  5. Copy data fom parent file to child files with different layouts
    By Marloes in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2014, 05:12 AM
  6. Replies: 0
    Last Post: 04-21-2014, 04:03 PM
  7. [SOLVED] copy subfolders, replace text in files and save files in copied subfolders
    By pieros in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-01-2005, 09:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1