pytags(1) set and remove tags on media files from filename and options


pytags [OPTIONS] file [file...]



is a simple, general-purpose tool for setting and removing media file tags. With no options, pytags prints a tag summary for all files specified on the command line. Options can be used to set and remove tags on files.

Using --format, it is easy to change or create tags on by parsing metadata from filenames according to an arbitrary format string. This makes it simple to tag files that are consistently named.

Additionally, tags can be manipulated directly with the --add, --set, and --remove options. These options are processed in order, so options specified later on the command-line may cause values set by earlier options to be overwritten. These options must appear after the --format, if it is used.



Append a tag value all files according to EXPR. EXPR should be an expression like "artist=Foo". May be specified multiple times to add multiple values.


Tag files with metadata extrapolated from filenames using format string FORMAT; see the section called "FORMAT STRINGS". This option must be specified before --add, --set, or --remove.


Set a single tag on all files according to EXPR. EXPR should be an expression like "artist=Foo". May be specified multiple times to set multiple tags. --set cannot be used to specify multiple values for a single tag. To do that, use --remove followed by multiple --add options.


Remove tags named TAG. May be specified more than once to remove multiple tags.

-h, --help

Show summary of options and exit.

-v, --version

Show version of program and exit.


The format string expected by --format is the same as that for pytagsfs. See the pytagsfs manual page for more information.


Remove the genre tag from all .ogg files in the current directory.

$ pytags --remove genre *.ogg

Set the artist and album tag on all .mp3 files, and remove the genre tag.

$ pytags --set artist=Foo --set album=Bar --remove genre *.mp3

Tag all of the .flac files in the current directory. All such files are assumed to be in the format "tracknum artist - trackname [album].flac".

$ pytags --format '%n %a - %t [%l].flac' *.flac


Please report bugs on launchpad at

pytags relies on mutagen (the underlying Python tags library) to choose an appropriate tag format for the files being tagged. This cannot currently be overridden.


Forest Bond



Copyright © 2007, 2008, 2009