function funline($strin="hello")
{
$num=$strin.length
for($i=1;$i -le $num;$i++){$funline = $funline + "="}
Write-Host -ForegroundColor Yellow $strin
Write-Host -ForegroundColor DarkRed $funline
}
$folder="C:\Users\qliangliang.BOOK\Documents"
$date=get-date
$limit=3
$xfiles=$Null
Get-ChildItem -Path $folder -Force | ForEach-Object {
$newdate=($_.LastAccessTime).AddDays($limit)
$limitDate=New-TimeSpan -Start $date -End $newdate
if($limitDate -le 0)
{
[email protected]{$_.Name=$_.LastAccessTime}
}
}
funline("the expired files art listed below")
$xfiles
时间: 2024-10-31 15:01:14