Posted:July 25, 2005

Preparing to Blog – File Organization and Naming

Since I have an interest in including images in some posts and providing PDF or spreadsheet downloads in others, how should that stuff be organized, named and referenced within my directory structure? While, of course, there are innumerable ways to handle these questions, here is the approach I have undertaken and refined, with some rationale for each.

File Organization

Under my WordPress theme directory (AI3), I have set up separate subdirectories for files and images. Under each of those subdirectories, I have set up a number of parallel subdirectories:

  • PaperName — wherein the ‘papername’ is set up for long, complicated posts
  • Posts2005 (etc.) — all files or images for other posts are placed under this subdirectory. I chose to use the year designator knowing that the volume of my posts and associated files and images will require at least that level of granularity. Should too many files be placed in these directories, I may move to a quarterly designator in future years as well
  • All images are placed under the images branch; all files (PDFs and XLSs, etc.) are placed under the files branch.

File Naming

I have three objectives for my naming conventions:

  1. Enable files or images to be sorted in a logical order
  2. Enable files or images to be clustered within their parental post
  3. Provide some logical component in the name to identify the content of the file or image.

To achieve these objectives, I construct a four-part name:

datestampsequence_logicname.extension

The datestamp is provided in YYMMDD format. This order is used because it enables proper sorting in file managers or Open and Save dialogs. The sequence is simply an alphabetical sequence to account for potentially multiple posts within a given day. Most will obviously have the a sequence; rarely will there be more than a b to d in the sequence. The logicname is the content designator and is prefaced by an underscore for readability. (If there are multiple words in the logicname, I also initial cap with no spaces for readability and to save space.) For example, longer posts may have multiple images embedded in them; the logicname simply allows quick choices among these multiples. Lastly, the extension simply conforms to the file type.

Thus, a logo GIF included in my second post of June 25, 2005, could have an HTML reference in the post somewhat like (without angle brackets):

img src="http://www.mkbergman.com/wp-content/themes/ai3v2/images/050625b_MyLogo.gif"

Note the first part of the path is a contextual reference to the subdirectory location on the server.

A sorted directory listing may also look somewhat as follows, with all related items properly sequenced and clustered:

050625a_PriceChart.gif
050625b_BarbLogo.gif
050625b_JoeLogo.gif
050625b_MyLogo.gif
050627a_Revenues.jpg

Using these techniques provides uniformity of referencing within my posts and a quick, known path for getting to and identifying every file and image available.

 

Author’s Note:  I actually decided to commit to a blog on April 27, 2005, and began recording soon thereafter my steps in doing so.  Because of work demands and other delays, the actual site was not released until July 18, 2005.  To give my ‘Prepare to Blog …’ postings a more contemporaneous feel, I arbitrarily changed posting dates on this series one month forward, which means some aspects of the actual blog were better developed than some of these earlier posts indicate.  However, the sequence and the content remain unchanged.  A re-factored complete guide will be posted at the conclusion of the ‘Prepare to Blog …’ series, targeted for release about August 18, 2005.  mkb

Schema.org Markup

headline:
Preparing to Blog – File Organization and Naming

alternativeHeadline:

author:

image:

description:
Since I have an interest in including images in some posts and providing PDF or spreadsheet downloads in others, how should that stuff be organized, named and referenced within my directory structure? While, of course, there are innumerable ways to handle these questions, here is the approach I have undertaken and refined, with some rationale […]

articleBody:
see above

datePublished:

2 thoughts on “Preparing to Blog – File Organization and Naming

  1. I have a suggestion regarding your date format.
    I’ve found that the yymmdd format leaves some ambiguity.
    For example, 042505 could easily be viewed as either
    yymmdd or ddmmyy, both common formats.

    Expanding the format to yyyymmdd, you get all the benefit,
    like sorting, without any ambiguity.

  2. I think this is a good suggestion. It also works better when there are files from earlier than 2000, though granted that is a once in a millenium event (though using the full YYYY would also work better every 100 years)!

    I will switch to this new method.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>