scheduling automated file name change

82 views Asked by At

I'm trying to schedule a task to edit the names of images. Images from 123-1234.jpg to 123_1234.jpg for example.

This is what i have now.

powershell.exe -noexit -command "cd'C:\path\i\want" Get-ChildItem -Filter "*.jpg" -Recurse | Rename-Item -NewName {$_.name -replace "-", "_" }

Appreciate the help.

My reasons for needing this code are that i have 1 software that produces images in various extensions however the way it names the files is like this 12345-123456.jpg

The other Software i have imports names like this 12345_123456.jpg.

This would solve me needing third party software if i can create an automated task to simply change all the .jpg in a directory to the needed name format for the automated import.

1

There are 1 answers

0
jake percival On
powershell.exe -noexit -command Get-ChildItem 'C:\my\file\path\' -Filter "*.jpg" -Recurse | Rename-Item -NewName {$_.name -replace '-','_' }

Im proud of myself as this is my first time using Powershell. This worked fine.