Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Recursively enumerate the tag files beneath the current directory ...
$tagFilesToKill = ls -rec "!.tags" | `
# ... find the ones whose parents contain zero FLAC files ...
? {(ls -LiteralPath $_.Directory | ? {$_.Extension -ieq ".flac"}).Count -eq 0} | `
# ... and select the full path to the parent.
select -ExpandProperty FullName
# Display the list of files to kill.
$tagFilesToKill
# Uncomment this line to actually kill them.
# $tagFilesToKill | % {rm -LiteralPath $_}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.