I needed to rename a bunch of files, all starting with “POD_”. I wanted to remove the “POD_” from every file. In my eager to learn Powershell this was a good opportunity to launch the Powershell ISE. After a short Google Search this made my life more Powershellish:
dir -filter "POD_*" |
rename-item -newname { $_.name -replace "POD_*", ""}
The “dir –filter “POD_*” command locates all files. These are piped to the rename-item cmdlet. Using the “-newname” param and some regular-expression, the files are renamed as wanted
Ingen kommentarer:
Send en kommentar