我想要一个脚本列出文件夹/子文件夹中具有特定最后访问日期的所有文件。
我有一个脚本显示子文件夹:
get-childitem -Recurse | Where {$_.psIsContainer -eq $true} | select {$_.Fullname}
谢谢你的帮助。
Get-ChildItem -Recurse | ? { $_.lastaccesstime -ge [datetime]"12/18/11"} | select fullname
给你一个lastaccesstime属性大于等于18 December 2011 00.00 am的文件列表。
Get-ChildItem -Recurse | ? { $_.lastaccesstime -ge [datetime]"12/01/11" -and $_.lastaccesstime -lt [datetime]"12/02/11"} | select fullname
此文件的最后访问时间为2011年12月1日从00.00am到11.59pm
lastaccesstime是对日期和时间的完整引用,这就是为什么需要为单个日期匹配指定范围的原因。