Powershell to move pictures

powershellFor the birthday of our kids my wife creates hard-copy Photo Books. The procedure is time consuming but worth every minute.

Recently I migrated to the new Photos app on my MacBook. The Software for creating the book is on Windows. This means exporting the pictures to disk and moving them to another device (am looking into Parallels) Since the export creates a folder per “event” combining them into monthly folders would take ages. The event folders came with the month spelled out and that is what I used to get the files into the month folder.

See the script below.
First get-childitem selects all folders in the current folder.
Then select all folders that have october in the name.
Get the childitems (the pictures inside the folders).
Last move the pictures to a new folder called 10-2015.

get-childitem | where name -Like '*october*' | `
    Get-ChildItem -Recurse | `
    Move-Item -Destination f:\10-2015

Powershell actually did it in 5 minutes. 30 seconds to figure out the syntax and 4 minutes waiting for the copy of the files to be moved.

About erictummers

My work as a recruited developer changes almost every month. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s