Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Find all cue files in a subfolder of the current directory ...
ls -Recurse *.cue | `
# ... for each one, get its parent folder ...
select -ExpandProperty Directory | `
# ... and if it contains a !.tags file ...
? {test-path -LiteralPath $_\!.tags} | % {
# ... open it ...
gc -LiteralPath $_\!.tags | `
# ... select only the entries that refer to FLAC files ...
jq 'map(select(.[\"@\"] | match(\"flac$\")))' | `
# ... produce a !.tags.new file containing those entries ...
out-file -Encoding "UTF8" -LiteralPath $_\!.tags.new
# ... overwrite !.tags with !.tags.new ...
rm $_\!.tags; mv $_\!.tags.new $_\!.tags
# ... and emit the name of the parent folder as feedback.
$_
}
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.