Concatenate Folder Names

Messages
6,502
Name
Peter
Edit My Images
Yes
I've got a number of folders containing subfolders on my Windows 7 laptop. What I'd like to do is rename the subfolders using a concatenation of the parent folder name and the subfolder name. For example

c:\folderA\subfolderB becomes c:\folderA\folderA+subfolderB​

Actually ideally I'd like to additionally copy each of these newly named subfolders to another folder at the top level i.e. not within their original parent folder. For example

c:\folderA\subfolderB is renamed and copied to d:\folderA-subfolderB​



I'm not sure I've made the above that clear but let's see if someone has worked out what I've been saying.
 
Not sure batch files will be up the job, been a long time since I've tried to do anything in them! PowerShell should do it.
 
Run the command:
dir /s /b /o:n /ad > f.txt

to create a text file of your folder structure

Then create a batch file and use the ren command:

ren "directory name from f.txt with spaces need quotes" "new directory name from f.txt another directory name with spaces"

You can maniuplute the f.txt file in excel the save as a txt file before resaving with a *.bat extension to run at the command prompt.

I would test with one directory first.

Should nt be too tricky, hardest part is just getting the excel file right.
Column 1 - ren
Column 2 - old directory name
Column 3 - new directory name based on above folder and column 2

Good luck
 
Thanks for the replies Chris, Robert, Karl and Jeff.

I gave the Bulk Rename Utility a go and it seems to almost get to where I'm need to go when I tested it. I'll try the other methods tomorrow to see which works best.
 
Another vote for Bulk Rename Utility. It's insanely flexible and powerful, and it's free. (*) It allows you to review the effects of the changes you're making before you commit them. What's not to like?

(*) It's free if you want it to be. But I find it so useful, I donated some beer tokens to the developer. It's not often I do that.
 
Back
Top