Hi,
I am comparing 2 folders and copying the different files. Unfortunately I have some files (after a specific date) that I don't want to copy. Can I exclude these files using date modified property? Here is what I have so far:
$source = 'e:\folder1'
$destination = 'e:\folder2'
#Compare the 2 folders
Compare-Object $Folder1 $Folder2 -Property Name | Where-Object {$_.SideIndicator -eq "<="} | ForEach-Object {
#Sudo code
If date modified less than 10 days
Copy-Item "$source\$($_.name)" -Destination "$destination" -Force
#write-host $source\$($_.name) -foregroundcolor red
}
Thanks
James
Alter De Ruine