Last active
October 29, 2016 16:31
-
-
Save taqpan/b4315d6e4e3e4e29b3be36c73090f0f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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