2015-05-19 105 views
-1

我需要在cmd中检查是否有最近修改过的特定文件(90分钟)。在Windows控制台上查找最近修改的文件

在Linux上,我命令效果很好:

find /home/my_folder -type f -mmin -90 -name *.txt 

在MS-DOS,我无法找到一个方法来过滤。关于修改时间:

forfiles /P directory /S 
+0

windows cmd,也许它不是正确的名称(通常我不使用winz)。 Win7 – user3472065

+0

只需安装[cywgin](http://cygwin.com) - 这样你就可以在Windows上使用熟悉的* nix命令,比如'find'。 –

回答

0

可以使用/ C参数:

/C command指示要为每个文件执行的命令。 命令字符串应该用双引号 引号包装。

    The default command is "cmd /c echo @file". 

        The following variables can be used in the 
        command string: 
        @file - returns the name of the file. 
        @fname - returns the file name without 
           extension. 
        @ext  - returns only the extension of the 
           file. 
        @path - returns the full path of the file. 
        @relpath - returns the relative path of the 
           file. 
        @isdir - returns "TRUE" if a file type is 
           a directory, and "FALSE" for files. 
        @fsize - returns the size of the file in 
           bytes. 
        @fdate - returns the last modified date of the 
           file. 
        @ftime - returns the last modified time of the 
           file. 

        To include special characters in the command 
        line, use the hexadecimal code for the character 
        in 0xHH format (ex. 0x09 for tab). Internal 
        CMD.exe commands should be preceded with 
        "cmd /c". 

Ex:- forfiles /S /M *.txt /C "cmd /c echo @path @file @fdate @ftime" 

认为这可能会有所帮助。您可以使用forfiles /?查看更多帮助详情。

相关问题