Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search by date using command line

Is there any way to search for files in a directory based on date? I want to find all files with created date greater than a specific date, is it possible to do it with dir command?

like image 299
Karim Harazin Avatar asked Feb 10 '12 20:02

Karim Harazin


People also ask

Which DOS command list files by date?

The dir command is used to list the files and subdirectories in a directory. The "/O:D" with the dir command is used to list the files by the date of the modification from the oldest first.


1 Answers

Just discovered the forfiles command.

forfiles /s /m *.log /d -7 /c "cmd /c echo @path"

Will list all the log files modified more than seven days old, in all subdirectories, though it does not appear to look at the create date. It does support specifying a specific date.

See forfiles /? for more info.

like image 153
David Avatar answered Oct 05 '22 18:10

David