Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Renaming multiple subfolders in multiple folders at once

13 Apr 2016   #1
kimpossible1978

Windows 8 PRO 64bit
 
 
Renaming multiple subfolders in multiple folders at once

I need some help with renaming multiple subfolders in multiple folders quickly without having to download a program for assistance. So, I have ten folders on a shared drive, lets say named 2000 to 2010 for each year, each of those have 26 folders (one for each letter of the alphabet) then each of those have up to 100 folders and each of those have 6 subfolders.

all of these folders have already been named, there is one folder out of the 6 that needs to be renamed in every folder so its currently named excel, but needs to change to working file. Is there a command prompt I could use? Please don't tell me I have to do it manually folder by folder


My System SpecsSystem Spec
.
13 Apr 2016   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi,

Quote   Quote: Originally Posted by kimpossible1978 View Post
So, I have ten folders on a shared drive, lets say named 2000 to 2010 for each year [...]
2000 to 2010 would actually represent eleven items, but I'm going to assume the folder names don't matter anyway.

From what I'm getting from your description, you want to rename folders named “excel” to “working file” that are exactly 3 subdirectories deep from the directory you say contains ten folders. If this is correct, you can easily do this through PowerShell...

Open a new PowerShell session and enter the following:
Code:
cd "<the path of the directory that contains the ten folders here>"
Then enter
Code:
dir -fi 'excel' -r | ?{(([uri]$_.FullName).Segments.Count - ([uri]$pwd.Path).Segments.Count) -eq 4} | %{$_.FullName}
Which will should list the folders you are trying to rename. This may take a while. If the output is correct, proceed to rename those folder using
Code:
dir -fi 'excel' -r | ?{(([uri]$_.FullName).Segments.Count - ([uri]$pwd.Path).Segments.Count) -eq 4} | %{ren $_.FullName 'working file'}


Quote   Quote: Originally Posted by kimpossible1978 View Post
Please don't tell me I have to do it manually folder by folder
That would be daunting. 10*26*100 = 26000 would be a lot of folders to go through.
My System SpecsSystem Spec
14 Apr 2016   #3
kimpossible1978

Windows 8 PRO 64bit
 
 

Hi Pyrophly,
Really appreciate your response, unfortunately I do not have Powershell. I work in a corporate environment so our IT dept have blocked any ability to download anything yes doing this manually is a rather daunting job therefore I was hoping I could just use a command prompt type code (excuse misuse of programming language as I am no boffin) I am sure the code you provided would work perfectly, but yeah as mentioned I cannot access powershell.

Thanks for taking the time to help me I really appreciate it
My System SpecsSystem Spec
.

14 Apr 2016   #4
kimpossible1978

Windows 8 PRO 64bit
 
 

Hi Pyrophly

Thanks for your response, I have inserted the code exactly as described up to the end of the 2nd line you'd sent, but I am not getting that list as you described, its just hanging? no error code or anything, just nothing happening? am I doing something wrong?
My System SpecsSystem Spec
14 Apr 2016   #5
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

As there are many files, it may take a while before any output is displayed.

If the command completes (the prompt will reappear and you'll be able to type again) without any output, you'll have to explain to me again, with precise detail, the exact process you are trying to achieve. Please use examples where possible.
My System SpecsSystem Spec
14 Apr 2016   #6
kimpossible1978

Windows 8 PRO 64bit
 
 

Renaming multiple subfolders in multiple folders at once-file-renaming.jpg
I've attached a screenshot everything I've typed in up to the end of the first code. after that, as you mention, the command completes yes without any output. so I am unsure what exactly I have done incorrectly.

I have folders on a drive with years 2000 - 2010, in those folders I have subfolders A - Z, in each of those folders I have folders with clients beginning with A in A - Clients beginning with Z in Z. And in those folders are the subfolders incorrectly named excel and these need to be renamed to working papers. As you've previously mentioned yes its approximately 26 000 folders needing to be renamed which is extremely daunting.


My System SpecsSystem Spec
14 Apr 2016   #7
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Code:
cd "<S drive (\\ct04) (S:)>"
The above line is incorrect. “<S drive (\\ct04) (S:)>” is not a valid path name. I’m not sure why that didn't throw an error.

Try,
Code:
cd "S:\"
My System SpecsSystem Spec
14 Apr 2016   #8
kimpossible1978

Windows 8 PRO 64bit
 
 

Its unfortunately still doing nothing no output at all aaarrgghh sorry for wasting your time
My System SpecsSystem Spec
14 Apr 2016   #9
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Kimpossible1978, I have put together a replica of the folder structure you’ve described for me. Use this to test the commands on.

Download the zip file attached below, extract the contents to an empty folder, double-click and run the mapper.bat file which will create a mapping of the folder to a virtual drive ‘P:’ (I hope this letter isn't reserved for you). Open a PowerShell window and type cd "P:\". Now try the listing again.

Here’s another command line that should also list your ‘excel’ folder. Try it as well.
Code:
gci ('*\'*4) | ?{$_.Name -eq 'excel'} | %{$_.FullName}


Attached Files
File Type: zip th-394633.zip (548.8 KB, 2 views)
My System SpecsSystem Spec
Reply

 Renaming multiple subfolders in multiple folders at once




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How to get folders to sort both subfolders and files?
When I sort my folders using "date modified," instead of ordering everything, I instead get all of the subfolders sorted, and then below that everything else, so it looks like this: FOLDER A: 10th Jan FOLDER B: 7th Jan FOLDER C: 5th Jan Randomfile.png: 12th Jan Randomfile.mp3: 11th Jan...
General Discussion
Offline folders to multiple network mapping drive folders
Hi, Newbe with a question. I am assuming it is possible to enable offline files of multiple network folders but I can't get it to work. Situation: Running Win7 ultimate 32bit on a domain. Server with 2 folder shares: Share1: test1
Network & Sharing
Renaming multiple folders
I am trying to rename 100's of folders with a persons name convention. What I have now is the first name first and a space and then a last name. Sometimes the first name is instead initials with periods and spaces and then the last name. What I am looking to do is have the last name changed to the...
General Discussion
Renaming multiple file extensions at once
How do i change multiple file extensions name all at once? I have all MKV file and would like to change it in to AVI. This process is taking far too long. Is there a shortcut to this? other than renaming each individual file. Thankyou
General Discussion
Folders say how many Subfolders are in a folder
I seen this picture of a persons folder in the "Content" layout and in my picture you will see where it says "Date Modified" and that's where it said the sub-folder and other information. Where would I go to change that? I've looked everywhere.
General Discussion
Multiple File Renaming
OK, hope this is the right forum, it is to do with pictures, amongst other things. I have a strange problem regarding renaming multiple files, mainly pictures as I have tons of them. Whenever I name all pictures in a folder, highlighting them all and renaming the first one, it renames the first 40...
Music, Pictures & Video


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 21:34.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App