powershell脚本找修改的文件

$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)    
}
原文地址:https://www.cnblogs.com/jzh-314/p/6879274.html