I have 500000 plus files in over 3000 directories and need to rename all folders called PHOTOS to Photos. I also need to Rename any Folders call Photos blah blah blah to be called just Photos. It needs to be recursive to crawl down through our convoluted file struct within a data dump drive z:

Any help appreciated


  • 2
    Could be possible that you end up with directories with the same name? If so, should they be number/ignored/something else? – Mixxiphoid Apr 22 '14 at 8:37
  • Can you please share the code you've tried so we can see what you're trying to do? – Dave Apr 22 '14 at 10:15

Here is a usefull script to rename your files under the z:/ drive:

Get-ChildItem Z:/ -Recurse | Rename-Item -NewName { $_.name -replace 'PHOTOS', 'Photos'}

Hope this helps.


  • Filtering the list before going to rename will wreak less havoc, take less resources, and run faster: Get-ChildItem M:/ -Recurse | Where-Object { $_.name -like "PHOTOS*"} | Rename-Item -NewName { $_.name -replace 'PHOTOS', 'Photos'} – Xalorous Nov 5 '15 at 0:42
  • since the user only wants to rename folders and not files, left of the pipe should read: get-childitem z:/ -Recurse -Directory – user527976 Nov 30 '15 at 18:44

Does it needs to be done with powershell ?

On windows, I use the GUI open-source tool called AntRenamer, which should work just fine for your needs.

Keep in mind that windows filesystems are case unsensitive, but case-preserving, you you will probably need to rename PHOTOS to something else like APHOTOS before renaming it to Photos. Otherwise, the system will not detect the change, and refuse to rename it.

  • Welcome to Super User! On this Q&A site we value answers. Your post is not an answer, but a comment of the original question. Please take this 2 minutes tour to understand how this site works : superuser.com/tour – Ob1lan Jul 6 '15 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.