简体   繁体   English

Windows等同于查找最近90天内访问的文件

[英]Windows equivalent to find files accessed in the last 90 days

What would be the Windows equivalent of these two commands that does not require installing any extra software: 这两个Windows命令等效于Windows,不需要安装任何其他软件:

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

You can do this using Powershell, which is usually installed by default with most modern versions of windows (or is easily installed if not already installed), by way of the get-childitem command. 您可以使用Powershell来执行此操作,Powershell通常通过get-childitem命令在大多数现代版本的Windows中默认安装(如果尚未安装,则很容易安装)。

To find files in c:\\data that are named *.sas and have been accessed in the past 90 days: 要查找c:\\ data中名为* .sas且在过去90天内已被访问过的文件,请执行以下操作:

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

To get a count of the number of files in c:\\data that are named *.sas and have been accessed in the past 90 days: 要获取c:\\ data中名为* .sas且在过去90天内已被访问的文件数,请执行以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM