首页 > 系统服务 > 详细

powershell 获取过期的文件

时间:2015-05-12 19:07:23      阅读:156      评论:0      收藏:0      [点我收藏+]


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)

    {

        $xfiles+=@{$_.Name=$_.LastAccessTime}

    }

}

funline("the expired files art listed below")

$xfiles


powershell 获取过期的文件

原文:http://3544640.blog.51cto.com/3534640/1650651

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!