Search code examples
windowspowershellcmdrenaming

script file: name editing and renaming using PowerShell


Does anyone know much about powershell?

I have about 3k files i want to edit the name of.. for example

90_12200.jpg

to

12200p.jpg

anyone know?


Solution

  • You can use Get-Child item with recursive option to load all the jpg files and rename it using Rename-item command.

    Get-ChildItem -r -path "C:\test" *.jpg | % { if(!$_.PSIsContainer -and $_.Name.Contains('_')) {Rename-item $_.FullName ( $_.BaseName.Split('_')[1] +"p" + $_.Extension) } }