Search This Blog
January 09, 2019
PowerShell: How to rename multiple files in a folder at the same time
To rename single file you can manually edit the file names. If there are multiple files you want to change the name of the file or part of the file name, it is easy to rename the file in PowerShell.
You can use rename-item with -Replace option like below. To replace ".StoredProcedure" in all the files present in the current directory with "_", you can use the following syntax
dir | rename-item -NewName {$_.name -replace ".StoredProcedure","_"}
For complete syntax and other examples visit the site at rename-item
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment