Hi @Nativus N00b ,
maybe this is helpful to get started (** Use on your own risk!**):
## Remove the -Whatif to execute the renaming ##
# Rename one file - for instance for testing
$file = "Junk/text 2020-12"
$fileObj = Get-Item -Path $file
$splitName = $fileObj.BaseName.Split(" ")
$newName = $splitName[1] + " - " + $splitName[0] + ($fileObj.Extension)
$fileObj | Rename-Item -NewName $newName -WhatIf
# Rename files in folder
$folder = "Junk/*"
$files = Get-ChildItem -Path $folder -File -Include text*
foreach ($obj in $files) {
$fileObj = Get-Item -Path $obj
$splitName = $fileObj.BaseName.Split(" ")
$newName = $splitName[1] + " - " + $splitName[0] + ($fileobj.Extension)
$fileObj | Rename-Item -NewName $newName -WhatIf
}
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten