+ Reply to Thread
Results 1 to 5 of 5

Relabeling files with multiple levels of subfolder titles.

  1. #1
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Relabeling files with multiple levels of subfolder titles.

    Hi everybody....first post for a while, but simply cannot find a fix on the net, and as need this for work urgently, I am seeking your expert assistance!!!

    So I have one big folder with multiple subfolders (some with their own subfolders) which are each labeled with a different name (of variable length).

    There are multiple files in each folder, some with multiple subfolders, but all files are of various formats, but no file greater than 200k.

    What I need is a macro / code, to go through each and every subfolder and label each and every file in that folder with the name of that particular folder at the beginning of each file.

    In the case of subfolders from the large root folder BUT WITH NO Further subfolders......e.g. FOLDER 123

    With files a.doc, b.whatever and c.somethingelse BECOMES

    123_a.doc, 123_b.whatever and 123_c.somethingelse

    However, the FOLDER 123 may well have its own level of subfolders (for example) labeled Red, and Blue.
    If there are subfolders, then……
    In the subfolder called Red there are files fish.xlsx and chips.whatever, whilst in subfolder Blue there are files called saltandvinegar.somethingelse and hopethisallmakes sense.doc........therefore these BECOME:

    123_Red_Cheese_fish.xlsx, and 123_Red_Cheese_chips.whatever, whilst the files in subfolder Blue become: 123_Blue_Cheese_saltandvinegar.somethingelse and 123_Blue_Chopethisallmakes sense.doc

    etc etc.

    There will be numerous levels of subfolders in any folder (max about 5 levels), so the length of the 'new' file names may be rather long, but I hope that my example shows what I am looking for.

    In an ideal world, I would really love these 'renamed files' to be transferred to a single new folder located say on the desktop, but if you can assist with this "renaming" convention, this would be a huge help!!!

    I know this is a big ask, but I truly am stuck and as there are several thousand subfolders all with a shed load of files, I really need your expert help, as otherwise it may well take days / weeks to do this manually!!!

    Many thanks for looking.

    Skyping
    Last edited by skyping; 05-08-2019 at 06:04 AM.

  2. #2
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Relabeling files with multiple levels of subfolder titles.

    Anybody have any ideas?

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Relabeling files with multiple levels of subfolder titles.

    This will copy all the files in a root folder and its' subfolders to a "Destination" folder on the desktop and rename the files as you described.

    Change the Root folder path to suit.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 05-07-2019 at 10:53 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Relabeling files with multiple levels of subfolder titles.

    Thank you so much Alphafrog.

    I will test this when I get to work in approx an hour. Will report back then.

  5. #5
    Forum Contributor
    Join Date
    09-11-2008
    Location
    uk
    MS-Off Ver
    2010; 2016
    Posts
    390

    Re: Relabeling files with multiple levels of subfolder titles.

    Hi Alphafrog…...fantastic....work brilliantly.

    SOLVED

    Many thanks

    Skyping

+ 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. Detail of directory and subfolder files
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2018, 09:35 PM
  2. Count pdf files in subfolder problems
    By moosmahna in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2017, 06:39 AM
  3. Replies: 0
    Last Post: 09-18-2015, 03:20 AM
  4. [ask]run VBA to multi files in subfolder
    By qiyusi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2015, 10:24 PM
  5. Info on titles and rep levels
    By jake.masters in forum Suggestions for Improvement
    Replies: 3
    Last Post: 11-13-2012, 11:51 AM
  6. Files move to a subfolder
    By Jokacave in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-22-2010, 02:13 PM
  7. Return files from a folder without Subfolder
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2009, 11:33 PM

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