Easily rename downloaded movies using powershell

07 Sep


As most people, I often complain about not having sufficient time. It also doesn’t help that I have a lot of hobbies and interests. Because of this I decided to combine my hobbies and interests in such a way it would eventually save me time.

Basically I decided to learn powershell scripting by automating the task of renaming downloaded movies. These need to be in a specific format for reliable use with the movie jukebox called Yet Another Movie Jukebox (YAMJ). As a result this will save me a lot of time in the future.

Concept for the script

The file names of most movies I download are mostly in the following format:
<>.<movie release year>.<metadata>.<metadata>…..<last.metadata>.<file extension>

What is important for YAMJ to work correctly is basically the movie name and the year (just in case there are movies with the same name, but released in a different year). So basically my preferred output would be:
The Devils Advocate 1997.mkv

To realise this, conceptually the following will be done for all files in a specific folder:

  1. Determine the current file extension and save it to a variable.
  2. Remove all dots “.” from the file name.
  3. Determine if there is a year notation in the file name (by example 1997).
  4. If there is no year notation found, don’t do anything else (file does not meet the expected format).
  5. If the year notation is found, remove everything from the file name after the year notation and re-add the file extension.

The script itself

The script itself can be found on my sharepoint list :

Closing thoughts

I hope this will help home users to see the advantages of scripts, use them and benefit from it. For ICT professionals I also hope that it will help them get a better understanding of Powershell. Because in my opinion Powershell is getting increasingly important both for Microsoft and non Microsoft products (by example VMware).

I’d love to get feedback about this post and hope to receive some replies.


Tags: , , , , , , , , , , ,

Leave a Reply

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

You are commenting using your 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.

%d bloggers like this: