Monday, December 6

It’s 2021 and I’m still afraid to use spaces in file names

I take a screenshot for an article like this and the traditional screenshot application dialog asks me what I want to call that file. I normally use a single descriptive word, but what happens when I want to use two or more? Here comes the problem: whether or not to use spaces in that filename.

I generally avoid them. This is strange considering that we are in 2021 and it seems that the old limitations regarding the use of characters in file names – do you remember when we wrote in uppercase? – disappeared. And even so, I try to avoid the use of spaces in filenames, and it seems that I am not alone.

Using spaces in filenames is not a problem until it ends up being.

Precisely that was mentioned by a user on Twitter whose message went viral. Many of those who answered that message they shared that feeling of “better not to use spaces”, although in most situations that would not be a problem.

The debate on whether or not to use spaces in file names has a long history. It is in fact common among programmers, that they explain in reality one can use any character in file names. Or almost, because the only ones that cannot be used are the character “” and the “NULL”.

The fact is that although one can use spaces, eñes or tildes (if for example we write on a Spanish keyboard), we usually avoid problems for fear that certain programs will not accept those characters. In web browsers the space is replaced by% 20 in the URLs that we use in the address bar, but that conversion does not usually go beyond that scenario.


In Linux for example one can use the string “” to represent a space, but one can also enclose the filename in quotes to access it from the command line. Something similar happens in the Windows console, although there it is necessary to access those files using quotation marks.


Programmers for example they try to avoid them when using Makefiles based build systems, but there also seem to be problems with them in done projects in Java language and some programmers make it clear: “be afraid to use spaces in file names“.

It is possible to find even strong recommendations not to do it: Michigan Tech University has a whole document explaining which characters are “illegal” (there is nothing) in filenames, and in addition to some that are certainly also somewhat scary like the at sign (‘@’) or the asterisk (‘*’) there is, of course, the white space.

What explained another user in the specialized SuperUser forum, the spaces “they can be a real headache in many contexts on the command line and in scripts, where care must be taken to ensure that they are displayed correctly so that they do not look like separators for the commands that are being executed. “

It is true that for most users that will not be a problem: it has been years since operating systems allow spaces and many other characters to be used in file names, and the normal thing is that problems of any kind do not arise.

And yet I am still there. Putting all the words together or, at most, using hyphens. Argh.

Leave a Reply

Your email address will not be published. Required fields are marked *