简体   繁体   中英

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:

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.

To find files in c:\\data that are named *.sas and have been accessed in the past 90 days:

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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