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

Working in a DevOps team is the best thing that happened to me. 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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.