Category Archives: Programming

Organize Media Files with PowerShell

I’ve never been happy with the way Windows imports photos, so I decided to look for a better way. I found this post on Steve Smith’s blog about how to rename photos and organize them using a PowerShell script. The script extracts the date each photo was taken from the file’s EXIF data, renames the files with the date, and organizes them into folders based on the month. This was close to what I wanted, but I also wanted to do the same thing with videos. Unfortunately, videos don’t contain the same kind of EXIF data. After some research and experimentation, I figured out how to extract the Media Created date from MP4 and AVI files.

My script recurses through the $SourceRootPath looking for any files with an extension in $FileTypesToOrganize. For each file, it extracts the appropriate creation date. In the case of JPG files, this comes from the EXIF DateTaken and for other file types this comes from the MediaCreated date. Using the date and the $DestinationRootPath it builds a path of the following format:

$DestinationRootPath\yyyy\MM_MMMM\yyyy-MM-dd HH.mm.ss.[ext]

Right now the script only works with JPG, MP4 and AVI files; however, it would probably work with other video formats simply by adding them to the list of extensions.

You can download my script here.


Getting WatiN Test Recorder to Run on Win7 64bit

I finally decided to check out WatiN today. The first thing I did was run the Test Recorder, but when I launched the app I received the following error:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {98EDB477-3064-4D0E-A09E-CC73F9AAB324} failed due to the following error: 80040154.

I’m running Windows 7 64bit. After digging around I found the solution is to run the following command (with administrator privileges):

corflags /32bit+ "C:Program Files (x86)WatiN Test RecorderTest Recorder.exe"

Obviously, change the path to the executable, if necessary.


Orchard 0.9 Released

Version 0.9 of Orchard CMS released yesterday. This release includes the addition of Orchard Gallery and Gallery Server, which are two related Open Source projects I’ve been working on since I joined NimblePros in November. Gallery Server is a general purpose, back-end component gallery, and Orchard Gallery is a front-end for it. (Gallery Server will also be the back-end for NuGet.) You can check out the Orchard Gallery in action at this demo site. This has been a very interesting project to work on and we still have a lot more to do before the 1.0 release next month.