PowerShell : Renaming And Sorting All My Music Files

We have a large collection of MP3s and FLACs and most of the time they all work great.  I’ve spent quite a bit of time getting their metadata correct so the various players we have all play them in the correct order as they use their Disc and Track number metadata to sort them.

However my wife’s and I’s cars both can read music from SD cards.  This is great as they’re a lot faster to process than phone libraries over Bluetooth but the downside is that the only sorting they do is via the filename.  This means every album plays it’s tracks in alphabetical order.

Ideally to fix this what I want is a script to rename each music file according to it’s Disc Number, Track Number and Title metadata.  The script I wrote to do exactly that follows, with some explanations after. Continue reading “PowerShell : Renaming And Sorting All My Music Files”

PowerShell : Finding Duplicate Files, Part 3 : A Resumeable Script Using Workflow

In the the previous part we looked at making the original script survive a restart without losing progress. There is actually a built-in PowerShell system which allows this functionality, the workflow. If you run a workflow as a job it allows you to pause, resume and restart the workflow so progress is saved.

The syntax is pretty straight-forward, but there are some strange rules about using workflows which makes it a little more tricky. Continue reading “PowerShell : Finding Duplicate Files, Part 3 : A Resumeable Script Using Workflow”

PowerShell : Finding Duplicate Files, Part 2 : A Resumeable Script

The main issue I had with my original script here was that with the sheer number of pictures we had it didn’t finish in a reasonable time.  What I needed was a way to allow the script to work and resume from an interrupt (like a reboot).  So I took the original script and whacked it with the ScriptHammer(TM) again.

Updated script after the jump with notes following!

Continue reading “PowerShell : Finding Duplicate Files, Part 2 : A Resumeable Script”

PowerShell : Finding Duplicate Files, Part 1 : The Basic Script

We have a lot of photos, music and files.  Normally we copy the files up to some network storage (so it’s backed up) and later on we come back and name and sort everything.  But then, some chaos happens;  maybe we get distracted so end up copying the files twice.  Or maybe we’ve been away and I’ve backed them up to another device and then copied two sets of files later.  Or a set of files were copied to another computer and some of them (but not all) were modified before copying them back.

The upshot is that there’s precious NAS storage being wasted.  But how to find where the duplicate files are?  Sounds like an excuse reason to put on my scripting hat!

Subsequently to writing this I did some more work on the script.  So now there are two more parts;  this post covers the basic script while part 2 details putting code in to allow resuming the script after a restart (or crash) and finally part 3 does the same thing but using PowerShell workflows.

Continue reading “PowerShell : Finding Duplicate Files, Part 1 : The Basic Script”

PowerShell : Record Process Time Script (Updated)

I’ve had the script I wrote to keep a record of certain processes run time running for  a while (I’m using it to keep a log of the games I play and when).  One thing I noticed though is that there are plenty of processes matching the path I’m interested in (anything with “games” in the file path) that I’m not interested in.  Launchers, background tasks, updaters or services for example.

What I need to do is set a list of exclusions and then make sure any process that matches the other criteria isn’t listed in the exclusions.  The changes are below;

Continue reading “PowerShell : Record Process Time Script (Updated)”

Tales from IT : Installing Servers in Style

I’ve been lucky enough to do quite a bit of travelling throughout my working life. Most of the time it wasn’t particularly glamorous (“Be an IT guy! See the inside of server rooms in exotic locations!”) but occasionally I’d get to do something particularly cool.

Like being driven to the centre of New York City in a chauffeur in an enormous stretch limousine.

Continue reading “Tales from IT : Installing Servers in Style”

PowerShell : Recording Process Run Time (Or, How Long Have I Played That Game For?)

I did a post about all the games I played in 2014.  The only source of data I had was the total play-time from Steam, but I really wanted a way of getting more detailed information (like when I played them and how long for).

I thought about it and I what I wanted was script that would record the time processes that were running on my system and write them to a file.  The script would stay running and update the file at periodic intervals to record how long the processes  had been running for.

Continue reading “PowerShell : Recording Process Run Time (Or, How Long Have I Played That Game For?)”

Tales from IT : The Great Snipe Hunt for DNS

One of the first places I worked was a software development house who’d built themselves up from a small group of developers into a pretty big (2-3 thousand) outfit.  Originally they had two IT departments;  one (where I worked) focused on the developers and one focused on everyone else.  When the company reached a decent size it was decided to merge the two as part of both unifying IT work and stopping all the squabbling between the two departments.

One of the first tasks was to bring all the company servers into a proper server room.  But first, we had to find the company’s servers…

Continue reading “Tales from IT : The Great Snipe Hunt for DNS”