Revision: 67162
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 18, 2014 08:27 by lottegis
Initial Code
get-childItem -recurse | Where {$_.extension -eq ".FILEXT"} | rename-item -newname { $_.name -replace "FROM","TO" }
Example
PS C:\Users\GIS\Heartland\docs\Agreements> get-childItem -recurse | Where {$_.extension -eq ".pdf"} | rename-item -newname { $_.name -replace "ALS","ALSCorp" }
Initial URL
Initial Description
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.
Initial Title
Mass-rename files recursively
Initial Tags
Initial Language
Windows PowerShell