Windows PowerShell: Rename files in a folder

Right click "Start" and select Windows PowerShell.
In the PowerShell, use "cd" to move to the directory(folder).
e.g.
cd C:\Users\[User Login]\Documents\test\
to move to "test" folder in your Documents folder.

To rename files in this current folder, use PowerShell command like below.
Get-ChildItem "*.jpg" | Sort Name | % { $i = 1} { $Newname = "rename_image" + $i.ToString("000") + $_.extension; Rename-item $_ $Newname; $i++ }
This renames all jpg files to "renamed_image###".jpg
If there are three jpg files, the files will be
renamed_image001.jpg
renamed_image002.jpg
renamed_image003.jpg
 

Comments

Popular posts from this blog

HIK: Getting current character and current source.