musictl
A CLI for music library automation. musictl recursively finds music files, reads their metadata, and copies/links them into an organised output directory using metadata-derived path templates.
Commands are pipe-friendly — list prints one file path per line, and both metadata and copy accept file paths via stdin or as arguments — so you can chain them together.
AI usage
Some code is AI-assisted, but always human-approved.
Installation
go install github.com/varun305/musictl@latest
Or build from source:
git clone https://github.com/varun305/musictl
cd musictl
go build -o out/musictl .
Commands
list — recursively find music files by extension
metadata — read tags/audio properties and print them as TSV
copy — copy, hard-link, or symlink files into an output directory using a %token% path template
Run musictl <command> --help for the full set of flags and available metadata columns/template tokens.
Examples
# List all music files under a directory
musictl list ~/Music
# Print artist, album, title and duration for a file
musictl metadata -H -c artist,album,title,duration ~/Music/track.flac
# Preview where files would land without writing anything
musictl copy --dry_run -o /tmp/out ~/Music/unsorted/
# Organise files by codec, then artist/album
musictl copy -o ~/Music/sorted \
--format "%codec%/%artist%/%album%/%track_number% - %title%.%ext%" \
~/Music/unsorted/*.flac
# Chain commands: find lossless files, then hard-link them into a library
musictl list -e flac,alac ~/Downloads/new-music \
| musictl copy -o ~/Music --mode hardlink
License
See LICENSE.