More uses for file organisation conditionals

Question mark

bliss's file organisation patterns allow a simple one line expression to re-organise 1000s of music files into a consistent hierarchy. However, there can be problems when the file organisation pattern references tags that don't exist in all of your music files.

Conditional expressions allow you to define music file organisation structures in bliss that are tolerant of missing tags. Initially this was only shown to work with <discnumber> tags, but conditionals can be used to tolerate any missing tags, including <tracknumber>.

A conditional expression, ?, was added to bliss's file organisation capability some time back.

Initially I implemented this for use with the then-new <discnumber> token, because such tags are less common than those associated with the other tokens. As an absent tag leaves the file organisation rule unable to continue, mass automatic re-naming and moving of files would otherwise become problematic when using the <discnumber> token.

The solution was to add a way of expressing a choice in the file organisation pattern: if a <discnumber> tag exists, use it. Otherwise, ignore the disc number. A file organisation pattern with a conditional expression looks like:

<album name>/<discnumber>?|<discnumber>/|<tracknumber>-<track name>

This would organise your music collection with one folder for each album, where if the files in the album have disc number tags they will be stored within intermediate disc number folders. For example:

Magical Mystery Tour/
	1-Magical Mystery Tour.flac
	2-The Fool on the Hill.flac
The Beatles/
		1-Back in the USSR.flac
		2-Dear Prudence.flac
		2-Yer Blues.flac
Abbey Road/
	1-Come Together.flac

The ? means: "if the tag relating to the preceeding token exists, evaluate the subsequent tokens in the | group. Otherwise, skip the | group".

The good news is that ? can be used after any token. The default file organisation patterns all include <tracknumber> but track number tags are not always included in music files. To work around this, you could try a conditional file organisation expression. Consider one of the default file organisation patterns:


You can make this tolerant of missing track numbers by changing it to:


Hope that helps!

Thanks to Desi for the image above.
tags: files folders bliss
blog comments powered by Disqus

The Music Library Management blog

Dan Gravell

I'm Dan, the founder and programmer of bliss. I write bliss to solve my own problems with my digital music collection.