Sunday, June 7, 2015

Make New Project Directory

I like to organize photos, videos, GIS projects, and developments projects in separate "project directories." Each project folder has the following format:
YYYY-MM-DD - Description

File Structure Example:
  • [Drive]:\
    • Development
      • 2014-10-04 - Scuba Calculators
      • 2015-06-01 - Make New Project Directory
    • GIS
      • 2012-05-14 - Whatever Project...
        • Shapefiles
        • Exports
        • From Client
        • MXDs
    • Photos
      • 2013-04-05 - Birthday in Midtown
        • Hilights
          • Edited
        • Original
      • ...
    • Videos

This is an easy way to chronologically catalog projects within their respective folders, but I'm lazy, and I hate having to look down at my task bar clock to find out what the date is, and I can't stand typing in that endless date!

Solutions Posted on GitHub

I posted all the scripts I came up with for this on my GitHub page under the Make New Project Directory repo.

Batch File

I originally tried coming up with a Batch file (.bat) to add the folder using the format I wanted. It's easy to make a predefined folder structure using CMD commands, but pulling that date style turned out to be a little tricky, so I looked elsewhere.

Python Script

I came up with a great Python script that will automatically add a folder that's named with the current date followed by XXXXDescriptionXXXX (so I could easily find and rename it further). Just double click the python file and the new project folder is added. Additionally, I repeated the code to add subdirectories for common sub-folders: Exports and Shapefiles for GIS projects; Originals, Highlights, and Edited for photos & video; etc.


Pros:

  • This is great! It works automatically
  • Simple code. It executes in 6 lines.  View the code here

Cons:

  • I quickly realized how awfully tedious it is to have to slow double click to rename, something every time I create a new project. I need some kind of interface to enter a project name, and I haven't had great luck using TkInter yet.
Note: I've heard good things about PyQt for an interface
  • I don't necessarily want those sub-directories for every project

VBScript

My best solution so far was to write a VBScript (.vbs format) to prompt me for a project name AND ask if I want to add those common project sub-folders.






Pros:

  • Most efficient method so far
  • Quick, easy, no renaming
Cons:


  • Slightly longer code (24 lines without comments & line continuation), but it does include some more logic handling. View the code here.
  • This is still generalized, and the "common subdirectories" option is hard coded (i.e. I don't need a Shapefiles directory in a video editing project).
Overall, This VBScript method opens the door to writing a slightly larger executable in Visual Studio with a more dynamic interface to add any kind of project folder - but that moves away from the original requirement of a highly rapid way to add a project folder automatically. I think this nails it.