Find files on Windows modified after a given date using the command line

前端 未结 7 1254
南旧
南旧 2021-02-04 07:40

I need to search a file on my disk modified after a given date using the command line.

For example:

   dir /S /B WHERE modified date > 12/07/2013
         


        
7条回答
  •  既然无缘
    2021-02-04 08:23

    If you decide to use PowerShell, this will also work with time and date ranges:

    Get-ChildItem -Recurse | Where-Object {($_.LastWriteTime -ge "04/15/2018 20:00:00") -and ($
    _.LastWriteTime -lt "04/15/2018 21:00:00")}
    

    To use a programmatic date or a Locale agnostic date time:

    Get-ChildItem -Recurse | Where-Object {($_.LastWriteTime -ge (new-object System.DateTime 2018, 1, 10, 12, 30, 00)) -and ($_.LastWriteTime -lt (new-object System.DateTime 2018, 1, 14, 12, 15, 59))}
    

    Where date and time are entered in increasing time specificity order:

    Year, Month, Day, Hour, Minute, Second

提交回复
热议问题