powershell 删除 复制 遍历某个文件夹 脚本
$timeOutDay = 30
$filePath = "E:\log"
$allFile = Get-ChildItem -Path $filePath
$i = 0
foreach($file in $allFile)
{
$daySpan = ((Get-Date) - $file.LastWriteTime).Days
if ($daySpan -gt $timeOutDay)
{
copy-item -Path E:\log\ -DestinationPath G:\日志
}
$i=$i+1
}