Skip to main content

One post tagged with "unix"

View All Tags

File Naming Conventions

File names with umlauts, accents, etc, can cause issues on older systems. They should work fine on newer systems that are up-to-date.

The safest approach is to completely avoid using any special characters.

Generally, I don’t use any characters for file naming outside of these:

  • numbers
  • lowercase English characters
  • hyphens -, and sometimes an
  • underscore _

1-2-3-4-5-6-7-8-9-0-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z.jpg

I avoid using the period except for separating the filename from a file name extension.

In this URL the period denotes the subdomain developers. This is another reason to not use periods indiscriminately. Periods are usually used for very specific reasons.

I always use hyphens to fill in spaces unless specifically directed to use underscores. Underscores are better than spaces, but hyphens are better than underscores because Search Engine Optimization (SEO) algorithims perfer hyphens. For that reason, I don't usually use CamelCase and stick to all lower case and hyphens.

Underscores used to be more common before SEO became an issue. I have noticed that php developers will still use underscores for system files that are included in other files. Another situation where a specific character is used in a very specific situation. SQL database names will not allow spaces or a hyphen, only an underscore.

_init.php
_main.php
_uikit.php
admin.php

Here is a nice file naming overview from the Pan Health Organization. (They obviously must deal with multiple language character sets all the time).

This pdf file below from the University of Aberdeen contains good information, but I find it ironic that the pdf file name does not use file naming conventions. (Note the four separate @20s that are inserted in the empty spaces. https://www.abdn.ac.uk/staffnet/documents/policy-zone-information-policies/File%20Naming%20Conventions%20July%202017.pdf