dos

DOS

# rename suffix
ren *.jpg *.png

PowerShell

Replace

# replace " " with "-"
Dir | Rename-Item -NewName { $_.name -replace " ", "-" }

Sort

# rename *.JPG to image_num.jpg
Get-ChildItem *.jpg | ForEach-Object -Begin {
  $count = 1
} -Process {
  Rename-Item $_ -NewName "image_$count.jpg"
  $count++
}

String

# find and replace "oldstring" to "newstring" 
Get-ChildItem *.jpg -Filter "*oldstring*" | ForEach {
  Rename-Item $_ -NewName $_.Name.Replace("oldstring","newstring")
}

Reference

results matching ""

    No results matching ""