I have a folder with media files named by timestamp like following yyyyMMdd_HHmmss_*.*
. I need to rename them to yyyy-MM-dd HH-mm-ss *.*
For example I need to rename file 20181019_210353_BURST2.jpg
to 2018-10-19 21-03-53 BURST2.jpg
There is a my ugly approach
PS E:> gci | Rename-Item -NewName { $_.Name.Substring(0,4) + '-' + $_.Name.Substring(4,2) + '-' + $_.Name.Substring(6,2) + ' ' + $_.Name.Substring(9,2) + '-' + $_.Name.Substring(11,2) + '-' + $_.Name.Substring(13,2) + $_.Name.Substring(15) }
What is the right command to obtain my purpose?