THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Merrill Aldrich

Organize Those Holiday Photos with PowerShell

My parents are here visiting with us for a little holiday vacation – and my mother is getting to be more and more computer savvy. She has an iPhone and a digital camera, and loves to take pictures. In fact, today she has almost 6,000 photos between the two devices! She takes so many photos that the media on the devices fills up, and then she goes back through the old photos deleting some just to make space. But moving the files to a computer or a DVD is still beyond her reach, so when she comes to visit there is usually a little family time burning all the photos that she has taken, since the last time we were together, to disks.

There are so many pictures and movies this time I created a PowerShell snippet to organize them into folders by year and month. In case anyone else needs to organize a giant folder full of files by date, I thought I would share:

Set-Location '\\Machine\MerrillAldrich\Mom''s Pictures'

get-childitem -Filter *.jpg | foreach {
    $y = get-date $_.creationTime -Format 'yyyy' 
    $m = get-date $_.creationTime -Format 'MM'
    $folder = join-path $y $m
    if ( ! ( test-path $folder ) ) {
        mkdir $folder 
    }
    move-item $_ $folder
}

In this case we put the photos onto my MacBook Pro, but PowerShell is so handy it was worth sharing the folder out on the network to run this little script from my ThinkPad.

Happy New Year!

Published Sunday, January 05, 2014 9:11 AM by merrillaldrich

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

ALZDBA said:

Nice script, Merrill.

It shows how you might do it the easy way.

However, it lacks to use the picture property "date taken", which is available using .Net properties in System.Drawing.

The script in this reference uses this property information, which will even make your photo library more accurate.

http://gallery.technet.microsoft.com/scriptcenter/Rename-picture-files-with-97738191

February 22, 2014 10:52 AM
 

Game Of War Fire Age Hack said:

Merrill Aldrich : Organize Those Holiday Photos with PowerShell

September 25, 2014 3:41 PM
 

minecraft username changer said:

Merrill Aldrich : Organize Those Holiday Photos with PowerShell

September 28, 2014 7:36 PM
 

sociopath test red hammer said:

Merrill Aldrich : Organize Those Holiday Photos with PowerShell

September 30, 2014 2:56 AM
 

http://deutsche-volkskultur.de/cgi-bin/info.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Fconfidencegames.com%2Fgame-war-fire-age-hack%2F%3Ehttp%3A%2F%2Fconfidencegames.com%2Fgame-war-fire-age-hack%2F%3C%2Fa%3E said:

Merrill Aldrich : Organize Those Holiday Photos with PowerShell

September 30, 2014 11:20 PM
 

simply click the up coming post said:

Merrill Aldrich : Organize Those Holiday Photos with PowerShell

October 1, 2014 1:42 AM

Leave a Comment

(required) 
(required) 
Submit

This Blog

Syndication

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement