I need to extract the fileversion of certain DLL files of which I do not know the name. All I know is where the file that holds the fileversion is located and that its name is the same as the folder it is hiding beneath.
In truth it's something like this:
C:\inetpub\wwwroot\APPFolder\bin\files
(where the name of the Subfolder matches the name of the file in the bin folder)
After many tries (and a lot of failures), I've gone a bit back and forth, and I'm now leaning comfortably at this bit of code .... close, but no cigar:
Get-ChildItem -Path c:\temp\Documents -recurse -Filter *.dll | where-object{ (Get-ChildItem -Path c:\temp\Documents -recurse -Filter *.dll) -match $_.Directory.Name }
This code searches for all the files recursively under \temp\documents
and then matches the files in the folders, which is nice ... but not quite what I wanted. Also the code above gives the folders where the files that match the folders they are in and not only the matched file.
So ... any suggestions? There are more than one DLL file in the bin folder mentioned above which is part of why I need to select the one with the same name as the APPFolder.