Et lille Powershell Script til at rydde op i TDCPlay's træls brandings i filer.


Param
(
[parameter(mandatory=$true,HelpMessage="Angiv RootPath til mappe med filer, ok?")][ValidateNotNullOrEmpty()]$RootPath
)

$AllFiles = Get-ChildItem $RootPath -recurse

foreach ($item in $AllFiles) {

$Ext =  $item.Extension
Switch($Ext)
{
".mp3" {
$OldName = $item.FullName
$NewFilePath = $item.DirectoryName.Replace("TDCPLAY_","")
if (( Test-Path $NewFilePath) -ne $true )
{
New-Item $NewFilePath -type directory
}
$NewFileName = $item.name.Replace("TDCPLAY_","")
$New = $NewFilePath + "\" + $NewFileName
Copy-Item $OldName $New
}
".wma"  {$item.Delete}
".m3u"  {$item.Delete}

}

}
}