Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Compare files based on LastWriteTime if basename matches

$
0
0

I have two sets of files, one folder contains one filetype and another folder contains the other filetype.

Folder 1 has .filetype1
Folder 2 has .filetype2

Every file in folder1 has a matching partner in folder2. The common thing is .basename. To get files where basename matches i'm just doing:

$dir1 | where {$_.BaseName -in $dir2.BaseName}

this however is not possible to do when comparing .LastWriteTime as that function will match $_.LastWriteTime to any file in $dir2.LastWriteTime

Pseudo:

If $_.Basename -eq $dir2.basename find files where .LastWriteTime differs  <-- help is wanted.


/Frederik Leed



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>