how to tell if a file is older than 30 days?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Jerry Geis wrote:

> I am trying to find out how to tell if a given file is 30 days or older.
> How is that type of thing done in shell scripts.
>
> Thanks,
>
> Jerry

As with all things *nix, there is more than one way to do the job. You 
might start with this idea -- or not.  If you wanted to list all files 
in the current directory over 29 days old (you said "30 or older) this 
would do it:

$ find . -ctime +29   -print
   --OR-- those older than 29 days in your home directory
$ find ~ -ctime +29 -print  
   --OR-- to discover older rpms in the yum cache
$ find /var/cache/yum -ctime +29 -print | grep .rpm

Man find is your friend.  Don't be overwhelmed by its many options; 
start simple and build up to your goal.

>
>------------------------------------------------------------------------
>
>_______________________________________________
>CentOS mailing list
>CentOS@xxxxxxxxxx
>http://lists.centos.org/mailman/listinfo/centos
>  
>




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux