Spaces in music filenames: just say no

It's important to keep music filenames and internal tags consistent. Typically the album name, artist name, track name and other 'tags' stored within music files are also replicated in the music files' location on your hard disc. Many music players can store files in such locations and will synchronise this location with the internal tags. Unfortunately, these players sometimes include spaces in the tag in the file location. For example:
C:\Music\Oasis\Definitely Maybe\
On first glance this seems fine. The album name is faithfully represented and if the computer supports it, why not use it? The trouble is that other software may not work as well with the spaces in the filenames.

This is especially a problem with Linux and other *nix operating systems like MacOS. On the one hand, these OSs have standardised toolsets that give a lot of power. There are many generic, flexible command line programs for working with your music library. The trouble is that the default delimeter used on the command line is also the space. Consider the following:
ls /Music/Oasis/
In *nix operating systems, this lists all the files in the Oasis directory.
ls /Music/Oasis/ /Music/Blur
Now, this lists all files in the Oasis and Blur directories.
ls /Music/Oasis/Definitely Maybe /Music/Blur/Parklife
So what does this do? The command fails, because it appears to the 'ls' command that we are asking for a listing of the 'Maybe' directory.

The workaround is to inform the computer that spaces in file and directory names should not be considered a delimiter for the command. This can be done by prefixing the space with a special character, generally '\' (this is called 'escaping') or quoting the entire string. E.g:
ls /Music/Oasis/Definitely\ Maybe /Music/Blur/Parklife
Or:
ls "/Music/Oasis/Definitely Maybe" /Music/Blur/Parklife
Longer term, it's far easier just to convert spaces into another well known, consistent character. Personally, I choose underscores. The next problem comes with a, say, ten thousand album collection. That's a whole lot of renaming required. This is why it's useful to have a rule based music library organiser.

Spaces in filenames: you'll regret it.
Thanks to Zimpenfish for the image used in this article.
tags: files spaces
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.