I have what should be a simple problem, but I just can't seem to get it right. I have a file that has two file extensions. We retrieve the file, decrypt it and save the encrypted file to a backup folder with a date/time stamp showing when the file was processed. All I want to do is to have the date/time stamp put before the two extensions instead of between them. There has to be a simple one line answer to this, but I can't find it. Any suggestions?
Original File Name - DAILY AP FILES.ZIP.pgp
Current Rename File Name - DAILY_AP_FILES.ZIP-02182013-155123.pgp
Desired Rename File Name - DAILY_AP_FILES-02182013-155123.pgp
Get-ChildItem "$dlpath\*.pgp" | ForEach-Object {
Move-Item $_.FullName "$BackupFolder$($_.BaseName.Replace(" ", "_"))-$(Get-Date -Format "MMddyyyy-HHmmss").pgp"
}