Trying to copy all changed files from a directory (recursively) to a new location, keeping the directory structure intact.
I put the changed files into an array: $datechanged = ($datechanged).addyears(-3) $changedfiles = ls -recurse | where-object{$_.lastwritetime -gt $datechanged}
Now I would like to copy these files (and directories?) to a new location, but am not sure how to proceed.
I have been trying the syntax of foreach, but I am not having much luck. I am doing this as a learning exercise, but with an actual goal in mind of archiving these changed files - so putting the files directly into a 7-zip file would be great for speed, but I would like to better understand how to deal with these arrays of objects and pipeline them.
Thanks!