0

I want to compare two directories $source and $destination and find any files that are in both but have a later timestamp in $destination. Including files in any subdirectories.

I found this but that returns me files that are newer in the source as well.(I changed the SideIndicator from '=>' to '<=' for my test but still no luck.

I only want the files that are more recent in the destination. e.g for these 2 source and dest dirs I would want returned Charles.txt and Ernie.txt.

Source Dir Dest Dir

Can it be done with Compare-Object somehow?

Many thanks

Keith
  • 251
  • 1
  • 4
  • 13
  • Do you want to compare them by name alone, or by relative path? – Mathias R. Jessen May 12 '22 at 10:36
  • There shouldnt be any files with same names in any subdirectories but if there was then yes by relative path I guess. So if there was ay a subdirectory DirOne\alan.text in both source and dest then if the alan.txt in dest\DirOne\Alan.txt was newer than source\DirOne\alan.txt Id want to know. – Keith May 12 '22 at 12:39

0 Answers0