$source = "MUSICSD" $device = "Sansa e280" $listDir = "Playlists" function findDriveByLabel { $drives = [System.Io.DriveInfo]::GetDrives() foreach ($drv in $drives) { if ($args[0] -eq $drv.VolumeLabel) { return $drv.RootDirectory } } } $sd = findDriveByLabel $source $dev = findDriveByLabel $device $sdDir = [System.Io.Path]::Combine($sd, $listDir) $devDir = [System.Io.Path]::Combine($dev, $listDir) $lists = ls $sdDir foreach ($lst in $lists) { $outFile = [System.Io.Path]::Combine($devDir, $lst.Name) $outFile Get-Content $lst.FullName | ForEach-Object { "/" + $_.Replace("\", "/") } | Out-File -Encoding utf8 -Width 1000 $outFile rm $lst.FullName } $remLists = ls $sdDir if ($remLists -eq $Null) { rmdir $sdDir }