Skip to content

Instantly share code, notes, and snippets.

@taqpan
Last active October 29, 2016 16:31
Embed
What would you like to do?
#
# Update all m3u files
# Arguments: working directories
#
$extensions = @(".mp3", ".m4a", ".flac")
$Args | % {
ls -r $_ | ? { $_.Extension -eq ".m3u" } | % {
$listfile = $_
pushd $listfile.Directory
"#EXTM3U" | Out-File $listfile -Encoding utf8
ls -r $_.Directory |
? { $extensions.Contains($_.Extension.ToLower()) } |
sort { $_.FullName } |
% { Resolve-Path -Relative $_.FullName } |
% { $_.Replace("\", "/") } |
Out-File -Append -Encoding utf8 $listfile
popd
echo $listfile.FullName
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment