1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
$path ='C:\temp\mes musiques'
Md $path > $null
Push-Location
"$path\_jacksons\Best of 12 Inch Gold Vol 11",
"$path\_jacksons\Best of 11 Inch Gold Vol 12",
"$path\_jeffrey osborne\Best of 12 Inch Gold Vol 05",
"$path\_jeffrey osborne\Best of 05 Inch Gold Vol 12"|
Foreach {
$CurrentPath=$_
md $CurrentPath > $null
Write-host "Create $Currentpath"
1..3|Foreach {
"Piste $_" > "$CurrentPath\Piste$_.mp3" }
}
Pop-Location
#Sous réserve que 2 artistes n'utilisent pas le même nom d'album
$DirToDelete=New-object System.Collections.ArrayList 10
Dir "$path" |
Where {$_.PSIsContainer}|
Foreach {
$Parent= Convert-Path $_.PSParentPath
$CurrentPath=$_.Fullname
# Write-debug "Current : $CurrentPath"
# Write-debug "Parent : $Parent"
[void]$DirToDelete.Add($CurrentPath)
Move-Item -Path "$CurrentPath\*" -Destination $Parent -Verbose -Whatif
Write-host
}
#$DirToDelete|Remove-item -Verbose -Recurse -Whatif |