Posted By

lottegis on 08/18/14


Versions (?)

Mass-rename files recursively

 / Published in: Windows PowerShell

How to use:

  1. In Powershell, change dir to the working directory of files in folders to rename.
  2. Replace FILEXT, FROM, and TO parameters.
    • FILEXT = file extension
    • FROM = string to replace
    • TO = string to replace with
  3. Execute the command.

What this will do:

  1. Goes into a folder.
  2. Finds files with the FILEXT extension.
  3. Finds the FROM substring of the found files.
  4. Replaces the substring with the TO string.
  5. Goes back to the current/parent directory.
  6. Redo these steps until all folders are entered.
  1. get-childItem -recurse | Where {$_\3.extension -eq ".FILEXT"} | rename-item -newname { $_\ -replace "FROM","TO" }
  3. Example
  4. PS C:\Users\GIS\Heartland\docs\Agreements> get-childItem -recurse | Where {$_\3.extension -eq ".pdf"} | rename-item -newname { $_\ -replace "ALS","ALSCorp" }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: jonathan987 on October 10, 2017

I use, Batch Rename Files Tool. You can easily found hier go to google and type BatchRenameFiles and check the first result that allows you to quickly rename all the files in a specified directory.

You need to login to post a comment.