Bulk Rename File History UTC with Powershell

I had a Windows Backup created with FileHistory but was not able to restore anymore because the DB seamed corrupted. Anyway the files were still there but they had the UTC Timestamp added. So here a script to remove the timestamps:

Before: Test (2017_08_03 13_49_28 UTC).jpg
New: Test.jpg

$regex=" \(\d{4}_\d{2}_\d{2} \d{2}_\d{2}_\d{2} UTC\)"

Get-ChildItem *UTC* -Recurse | Where-Object {$_.Name -match $regex} | Rename-Item -NewName {$_.Name -replace $regex} -Verbose

Warning: As always, use it on your own risk. If you should have the same file with multiple timestamps then you need to extend the script a bit. This one just works with unique files with timestamp.

admin on March 28th 2018 in IT, PowerShell, Windows, Windows Server

No Comments »

Comments RSS

Leave a Reply




Check out new movies online website. Download and buy movies now.
1