$sourcedir="D:workspace" $targetdir="E: ewf" $lastdate="2017-05-19" $filelist=dir $sourcedir -recurse *.* | where-object{ $_ -is [System.IO.FileInfo] -and $_.LastWriteTime -gt [datetime]::Parse($lastdate) } $filelist | ForEach-Object { $_.FullName $filedic=$_.DirectoryName $filedic=$filedic.Replace($sourcedir,$targetdir) md $filedic Copy-Item $_.FullName ($filedic+""+$_.Name) }