Here's one way to do it, using SubString:
function getNewFileName($fname)
{
$year = $fname.SubString(0,4)
$month = $fname.SubString(4,2)
$day = $fname.SubString(6,2)
$hours = $fname.SubString(9,2)
$minutes = $fname.SubString(11,2)
$seconds = $fname.SubString(13,2)
$new_fname = [string]::Format( "{0}-{1}-{2} {3}.{4}.{5}.jpg", $year,$month,$day,$hours,$minutes,$seconds)
return $new_fname;
}
To use this to rename a selection of file entries in a folder, you can use something like this:
$fileEntries = Get-ChildItem *_* -name
foreach($fileName in $fileEntries)
{
$newFileName = getNewFileName($fileName)
Write-Host -NoNewLine Rename-Item $filename $newFileName
Write-Host
}
As written, this script won't actually change anything - it lets you preview what would change by outputting the proposed rename command to the console. To actually rename the files you'd have to remove the "Write-Host" statements.
This script assumes that all you have in the folder are the two types of file names you mentioned.
$fileEntries = Get-ChildItem *_* -name
Selects only files containing an underscore so we don't try to rename the other type of file. This script is meant to run in the subject folder; running it elsewhere might do strange things to the wrong files.