Useful PowerShell commands & scripts

Below, you will find a variety of different PowerShell commands & scripts which I’ve needed in the past, or continue to use day-to-day. The post will be continually updated, and you probably found yourself here via a search engine.

Finding files which share the same file name, ignoring their extension

Useful for identifying media which has been transcoded into two different formats.

Get-ChildItem -Recurse -File | Group-Object -Property Directory,BaseName | Where-Object Count -gt 1 | Select-Object Name

Having two files, Lost - S01E01.mp4 and Lost - S01E01.mkv – would output the following:

PS C:\Media> Get-ChildItem -Recurse -File | Group-Object -Property Directory,BaseName | Where-Object Count -gt 1 | Select-Object Name

Name
----
C:\Media, Lost - S01E01

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top