0

How to list files before a specific date in bash?

closed as unclear what you're asking by Jeff Schaller, cuonglm, Anthon, Stephen Kitt, garethTheRed Jun 10 '16 at 7:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you try google? goo.gl/SWdqPz – Patrick Jun 9 '16 at 3:53
  • 4
    give us details on what have you tried and how did it fail.. you can use find command, for ex: find -mtime +7 to print files that were modified more than seven days back in current directory – Sundeep Jun 9 '16 at 3:57
  • 4
    Take a look at this answer: serverfault.com/a/122831 – Peschke Jun 9 '16 at 4:00
1

You cant see when the file was created due to most filesystems does not save creation date (ext3 ext4).

You can use find location -ctime time_period

eg: With -15 as time period you will see the files modified less than 15 days ago. +15 files modified more than 15 days ago, and just 15 files modified exactly 15 days ago.

-c flag shows when last permissions where changed.

-a flag shows most recent access date.

-m flag shows the last modification date.

You can also use this (for modification date) to find files by specific date:

find location -type f -ls |grep '10 Sep' You should change 10 Sep with your desired date.

Not the answer you're looking for? Browse other questions tagged or ask your own question.