Renaming multiple subfolders in multiple folders at once


  1. Posts : 5
    Windows 8 PRO 64bit
       #1

    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 Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    Hi,

    kimpossible1978 said:
    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'}


    kimpossible1978 said:
    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 Computer


  3. Posts : 5
    Windows 8 PRO 64bit
    Thread Starter
       #3

    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 Computer


  4. Posts : 5
    Windows 8 PRO 64bit
    Thread Starter
       #4

    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 Computer


  5. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #5

    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 Computer


  6. Posts : 5
    Windows 8 PRO 64bit
    Thread Starter
       #6

    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 Computer


  7. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #7

    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 Computer


  8. Posts : 5
    Windows 8 PRO 64bit
    Thread Starter
       #8

    Its unfortunately still doing nothing no output at all aaarrgghh sorry for wasting your time
      My Computer


  9. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #9

    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}
    Renaming multiple subfolders in multiple folders at once Attached Files
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 14:24.
Find Us