Created
July 14, 2015 11:21
-
-
Save ghotz/410dc5340f50b62afa9a to your computer and use it in GitHub Desktop.
Rename and moves perfmon logs formatted with a certain pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Normalizes perfmon logs names given a set of directories | |
# following the pattern COMPUTERNAME_YYYYMMDD-NNNNNN | |
# by moving log files to the root dir and assigning a unique name | |
$PALDir = "D:\Temp\PAL" | |
Get-ChildItem $PALDir -Directory | | |
? { $_.Name -match "(?<ComputerName>\w*)_(?<ISODate>\d{4}\d{2}\d{2})-(?<Sequence>\d{6})" } | | |
% { | |
$file = Get-ChildItem $_.FullName; | |
$file.MoveTo($PALDir + "\" + $Matches["ComputerName"] + "_PAL_" + $Matches["ISODate"] + "_" + $Matches["Sequence"]+".blg"); | |
rd $_.FullName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment