<# .DESCRIPTION This script deletes every maps that are not of the specified difficulty level. Check https://osu.ppy.sh/wiki/en/Beatmap/Difficulty to get the list of difficulty levels. Set the Songs folder path via $songsPath. And the desired level of difficulty via $difficultyRating. Depending on the Songs folder path you might have to run this script as Administrator. #> $songsPath = "D:\Osu!\Songs" $difficultyRating = "Insane" $mapsList = @() $mapsPath = (Get-ChildItem -Directory -Path $songsPath).FullName Foreach ($mapPath in $mapsPath) { $mapNames = (Get-ChildItem -Path $mapPath -Filter "*.osu").FullName Foreach ($mapName in $mapNames) { If ($mapName -Like "*$difficultyRating*") { $mapsList += $mapPath Continue } } } Foreach ($mapPath in $mapsPath) { If ($mapsList -notcontains $mapPath) { Remove-Item -Recurse -Force -Path $mapPath } Else { $mapNames = (Get-ChildItem -Path $mapPath -Filter "*.osu").FullName Foreach ($mapName in $mapNames) { If ($mapName -NotLike "*$difficultyRating*") { $mapName = $mapName.Insert($($mapName.IndexOf("[")), "````") $mapName = $mapName.Insert($($mapName.IndexOf("]")), "````") Remove-Item -Force -Path "$mapName" } } } }