jzh-314

生活<>生存

导航

powershell脚本找修改的文件

 

$sourcedir="D:\workspace"
$targetdir="E:\newf"
$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)    
}

 

posted on 2017-05-19 16:52  jizh  阅读(167)  评论(0编辑  收藏  举报