LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to find files which is modifed 01 year before (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-files-which-is-modifed-01-year-before-839741/)

rakeshkranjan 10-22-2010 05:49 AM

how to find files which is modifed 01 year before
 
how to find files which is modifed 01 year before, with size detail

T0sh1r0 10-22-2010 06:35 AM

Files modified 365 days ago:
find . -type f -mtime 365 -exec ls -l {} \;

Files modified 365 days or more ago:
find . -type f -mtime +365 -exec ls -l {} \;

Files modified 365 days or less ago:
find . -type f -mtime -365 -exec ls -l {} \;

For other options: man find ;-)

druuna 10-22-2010 06:36 AM

Hi,

find /full/path/to/startpoint -mtime +365 -ls

This shows files that are modified a year (and older) ago.

If you need files that are between 1 and 2 years old:

find /full/path/to/startpoint -mtime +365 -mtime -730 -ls

+NUMBER means older then NUMBER, -NUMBER means younger then NUMBER.

/full/path/to/styartpoint can be changed to a dot (.) if you execute the find command from the correct directory.

Hope this helps.

angel115 10-22-2010 06:39 AM

Code:

find . -type f -mtime 365 |xargs ls -l
Will give the file information too

or
Code:

find . -type f -mtime 365 |xargs ls -sh
Will give the file size only


All times are GMT -5. The time now is 03:16 AM.