2.3 How to name files and directories

How you name files and directories may not seem like an important point, but it can cause quite a headache if you try and use code to automate processes, and at best, it just slows things down. To quote Aaron Quinlan, a bioinformatician, “a space in a filename is a space in one’s soul”.

Instead try and use something like this:

  • KISS (Keep It Simple Stupid): use simple and consistent file names
    • It needs to be machine readable
    • It needs to be human readable
    • It needs to order well in a directory
  • No special characters and no spaces!
  • Use YYYY-MM-DD date format
  • Use - to delimit words and _ to delimit sections
    • i.e. 2019-01-19_my-data.csv
  • Left-pad numbers
    • i.e. 01_my-data.csv vs 1_my-data.csv
    • If you don’t, file orders get messed up when you get to double-digits