So…, I’ve got all these terrible file names.

In this post, dear reader, I am going to piggy back a little on a previous post by one of our electronic records archivists, Rachel Trent. Rachel’s article Taming Your Digital Files focused on recognizing and hopefully averting poor file naming and management practices in the future, but what about right now.

I mean right after you finished her article and said to yourself, “Self, that was a great article. I’m going to follow that good advice from now on.” How are you supposed to apply that knowledge to a hard drive containing 10 years of potentially poor file names like:

  • C:\2346sggf646657483.pdf
  • C:\Wow this is a really long folder name\I don’t even remember why I did that\I hope this is a joke!.doc

Tricky.  You could do it by hand, but insanity or terminal carpal tunnel syndrome would probably set in before you made it through half of your files.  In the interest of preserving your sanity, dear reader, at the end of this post I have   provided a small program that can specifically apply some of our best practices to your files, and I’ve listed a few other bulk renaming programs that allow for a more flexible application of your own file naming system.  Although, none of these tools will help you come up with meaningful file names to gain intellectual control over your files, they can, however, help you replace unsafe characters with safe characters in your file names, and add important file creation dates to the name that will aid in making records retention decisions in the future.

In our Files and Filing workshops (recently on tour throughout the state), my colleagues and I talked a lot about the importance of gaining intellectual control over your filing systems; both paper and electronic.  For electronic records, we recommend three things:

  1. A file or folder name should be descriptive enough to identify the contents.
  2. Avoid special characters like (!%$^#*()=+) and spaces
  3. Include the *creation* date of the file in ISO 8601 format at the end of the file name (YYYY_MM_DD).

Unfortunately, I can’t help too much with the first problem. If you have four hard drives full of documents with names like:

  • Doc 1.pdf
  • Doc 2.pdf
  • asdxi83473d89.pdf
  • to_be-titled-later.doc

then a lot of quality time with your files is the only thing to do; because, RenameIT isn’t smart enough to know what is inside of your files.

Don’t lose heart though, RenameIT can help with the other two best practices that we recommend and just a little with the first.  RenameIT will scan from a given directory (and its sub directories) and apply our best practice rules to your file names. It will remove all special characters and replace them with underscores, and it will check the creation date of your file and add the ISO 8601 format to the end of the file name right before the extension. The script will check to see if you want to make a change before it executes the change, and it will even ask if you would like to substitute your own file name instead (please follow best practices, though). If the file being inspected has a bad file name like “to be named later.docx” then you will have the option to change the file name to something that reflects its contents, like “August_Financial_Reports” (the script will add the date and the extension).  RenameIT can also take a bit of text and ad it to either the beginning or end of the original file name.  Say, for example,  you wanted to put your initials and a job number at the beginning of every file name in a particular directory (“JMG_JOBOO1”), you can do that with renameIT.  Prefer the same information at the end of a filename, RenameIT can do that too.

Here is an before and after example using the manual renaming function:


2013-10-01 16_09_01-TestNames


2013-10-01 16_11_00-TestNames_Fixed

As you can see, I chose to make a modification myself.  If I had just let the program make the change, then the file name would have been “This_is__bad_file_name_2013_10_01.txt.” In one sense, that is still a bad file name because it gives no indication of the file contents.

If the thought of bulk renaming thousands of files on your hard drive makes you nervous, good.  A rename could effect shortcuts, links or shared paths.  So, before renaming something make sure to always test on a small subset of your files before doing a bulk rename.  Also, unless you really know what you are doing, do not change any file names in a directory that hosts internet or intranet accessible files.

Good file names will help you find your needed documents in the future. Removing special characters will eliminate confusion and decrease the chance that your file will cause other electronic systems to react badly. For example, back slashes “\” in a file name would cause havoc with a windows machine.  Finally, adding a creation date to your file name will help when it comes time to apply a retention schedule to your files.  If you know exactly when a file was created then you can destroy the record appropriately when its retention period is complete.

Before I point you to my little program, I want to note that there are a couple of other bulk renaming applications available.  Bulk Rename Utility is a free utility that is very flexible.  ReNamer is another utility that can also edit metadata for certain file formats.

The script is a command line application called renameIT, and is written in Python. If that last sentence looks like I’m talking about a reptile currently invading Floridian military bases, then check with an IT person before downloading and attempting to use this script. Also, bear in mind, that renameIT is a very straightforward program if you do something it doesn’t expect most likely it will quit and print out a bunch of material that you may or may not have a clue what it means.  Don’t worry, just restart and try again. Forewarned is forearmed as they say.

So, you can find my program on Github. RenameIT is GPL, so, feel free to fork the script, rewrite it and make it better, stronger, faster, just give back.

renameIT repository


One thought on “So…, I’ve got all these terrible file names.

Comments are closed.