Do a recursive loop through the directory structure.
The final version of my script aimed to only show the difference (avoid noise), ideally show which direction the change occurred using Compare-Object in PowerShell. Also I had to compare these files in a third party tool like WinMerge anyway – taking away the point of doing this! In production with thousands of files and nested folders this was plain chaos. The downside of this is that it only really worked for my sample folder with a few items. The only “nicety” was I wrapped directory names in square brackets to give it some organisation. The first iteration was to do a recursive loop, pull out all the file names (Note: not the path) into 2 separate text files. Ideally also not spending longer than 10 minutes creating any code! WinMergecan perform fantastic comparisons, but I wanted something quick and custom. I didn’t really want to use a third party tool. The first iteration of this was a manual check which obviously is prone is human error – aside from being mind numbing! This came with some minor headaches such as validating we have harvested all the correct files. This post definitely isn’t “new” or revolutionary, but I was quite surprised to find the Compare-object helper in PS, and I’m bound to forget in the future…Īs part of some recent roadmap work, we moved over to a new installer technology for some of our tooling.