Skip to content

Instantly share code, notes, and snippets.

@taqpan
Last active October 29, 2016 16:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save taqpan/b4315d6e4e3e4e29b3be36c73090f0f8 to your computer and use it in GitHub Desktop.
#
# 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