I have the below script which i used to copy a set of user folders. I now have to copy them again, But this time only copy the folders / files that have been updated since the last copy. Is this possible?
$sourcepath = 'c:\temp'
$targetpath = 'g:\users'
$mapFile = 'C:\temp\UserNames.csv'
Import-Csv $mapFile -Header 'OriginalName', 'NewName' | ForEach-Object {
$src = Join-Path $sourcePath $_.OriginalName
$dest = Join-Path $targetPath $_.NewName
if(-not (Test-Path $dest)){ New-Item -Path $dest -ItemType Directory }
Get-ChildItem -Path $src | Copy-Item -Destination $dest -Recurse }