Linux Find Files By Date And List Files Modified On a Specific Date

To find files by date and list files modified on a specific date in Linux, you can use the find command and specify the date range or exact date you want to search for. Here are two examples:

  1. To find files modified within a date range:
find /path/to/search -type f -newermt yyyy-mm-dd -and ! -newermt yyyy-mm-dd

Replace /path/to/search with the directory you want to search in, and yyyy-mm-dd with the start and end dates of the range you want to search in. This command will list all the files modified between the start and end dates.

For example, to find all files modified between January 1st, 2022 and February 1st, 2022 in the directory /home/user/documents, you would use the following command:

find /home/user/documents -type f -newermt 2022-01-01 -and ! -newermt 2022-02-01
  1. To find files modified on a specific date:
find /path/to/search -type f -newermt yyyy-mm-dd ! -newermt yyyy-mm-dd+1

Replace /path/to/search with the directory you want to search in, and yyyy-mm-dd with the date you want to search for. This command will list all the files modified on the specified date.

For example, to find all files modified on February 1st, 2022 in the directory /home/user/documents, you would use the following command:

find /home/user/documents -type f -newermt 2022-02-01 ! -newermt 2022-02-02

Note: ! -newermt yyyy-mm-dd+1 in the command means files that are not newer than the next day, which effectively specifies a date range of exactly one day.

Leave a Comment