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.