Windows相当于查找过去90天内访问过的文件

时间:2014-07-26 00:01:41

标签: linux windows find

这两个命令的Windows等价物不需要安装任何额外的软件:

find ~/Data -iname "*.sas" -atime -90 -type f
find ~/Data -iname "*.sas" -atime -90 -type f | wc -l

1 个答案:

答案 0 :(得分:2)

您可以使用Powershell执行此操作,该程序通常通过get-childitem命令默认安装在大多数现代版本的Windows中(如果尚未安装,则可以轻松安装)。

要查找名为* .sas且已在过去90天内访问过的c:\ data中的文件:

get-childitem c:\data\*.sas | ? { $_.lastaccesstime -ge (get-date).AddDays(-90)}

要计算c:\ data中名为* .sas且已在过去90天内访问过的文件数:

(get-childitem c:\data\*.sas | ? { $_.lastaccesstime -ge (get-date).AddDays(-90)}).count
相关问题