user3472065
user3472065

Reputation: 1389

Find recently modified files on windows console

I need to check in cmd if there are specific files recently modified (90 min).

On linux, my command works well:

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

On MS-DOS, I cannot find a way to filter regarding modification time:

forfiles /P directory /S

Upvotes: 0

Views: 10837

Answers (1)

IUW
IUW

Reputation: 441

You can use the /C parameter:

/C command Indicates the command to execute for each file. Command strings should be wrapped in double quotes.

                    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"

Think this might be helpful. You can use forfiles /? to see more help details.

Upvotes: 1

Related Questions