Chapter 16 Files and Directories

When you do use a computer for a task involving local files, it is important to exercise a certain degree of hygiene when organising those files. This Chapter discusses a number of best practices relating to file management.

16.1 Characters you can use

Use filenames that are as much as possible self-explanatory, platform-independent, and safe to use in URLs. Therefore, use filenames that consist of the following characters:

  • The 10 arabic numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • The 26 uppercase latin script letters: 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
  • The 26 lowercase latin script letters: 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
  • The dash: -
  • The underscore: -
  • The dot: .

Of these, when using dots, note that dots are also used to separate files’ base name from their extension, so it is usually better to avoid these, even though they work fine at all platforms and in URLs.

16.2 Smart naming

It is also useful to use consistent patterns to enable quickly selecting related files. This allows you to use regular expression pattern matching to quickly select a set of files based on a criterion.