I went to my friend room last week to see cricket match. He got a new mobile phone and trying to copy all his favorite songs into it. After copying a few he realized that, file name that appearing his laptop and display name in phone are not same for songs he is copyin
I authored a small script, which reads files of given extension type and changes the title of them to file name. So that music players shows the same name when playing…
[powershell]
$files = Get-ChildItem -Filter *.mp3 -Path c:MyMusic -Recurse
$wmp = New-Object -ComObject wmplayer.ocx
foreach ($file in $files) {
$filename = $file.FullName
$fileshortname = $file.Name.Split(".")[0]
$metadata = $wmp.newMedia($filename)
if ($metadata.name -ne $fileshortname) {
Write-Host "Setting metadata"
$metadata.name = $fileshortname
}
}
[/powershell]