在 windows 控制台上查找最近修改的文件

Find recently modified files on windows console

如果最近修改了特定文件(90 分钟),我需要在 cmd 中检查。

在 linux 上,我的命令运行良好:

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

在 MS-DOS 上,我找不到过滤修改时间的方法:

forfiles /P directory /S

您可以使用 /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 /? 查看更多帮助详情。