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

前端 未结 7 1272
南旧
南旧 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:21

    I was after the size of the files changed and did not have PowerShell. I used the following, but the clue came from other posts:

    http://www.scotiasystems.com/blog/it-hints-and-tips/quick-way-to-find-recently-changed-files-in-windows and Windows command for file size only

    set Target=E:\userdata
    rem Date format is M-D-YYYY
    set date=12-13-2013
    set Filelist=d:\temp\filelist.txt
    set Sizelist=d:\temp\sizelist%date%.csv
    
    echo Target is %Target%
    echo Start date is %date%
    echo file list is %Filelist%
    echo Sizelist is %sizelist%
    
    Xcopy %Target% /D:%date% /L /S  > %Filelist%
    echo FileSize (bytes), FileName > %sizelist%
    
    For /f "tokens=1 delims=;" %%j in (%Filelist%) do (
                    call :Size "%%j"
                    )
    Goto :EOF
    
    :Size
    @echo off
    echo %~z1, %1 >> %sizelist%
    

提交回复
热议问题