Re: Date scripting

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

 



On Thu, 2006-03-23 at 12:05, Chris Norman wrote:
> I need to check files to see how old they are.
> 
> How can I do this from within a backup script?
> 
> I need to see if they are over a month old, and if so delete them. How do I 
> get they're last modified stamp please?


cd /path/to/start || exit 
find  . -type f -ctime +31 
would give you a list of files more than 31 days old.

find . -type f -ctime +31 -print0 |xargs -0 rm -f
would delete them - but be sure you know what you are
doing before you execute that... And be sure you
quit if you can't cd to the right place instead of
deleting in the wrong location.

-- 
  Les Mikesell
   lesmikesell@xxxxxxxxx



-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux