Re: Date scripting

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

 




Chris Norman wrote:
Hi people,
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?

Cheers,

Chris Norman
<!-- chris.norman4@xxxxxxxxxxxx -->

Take a look at the  stat command.  Perhaps something along the lines of

stat -c  '%n %z'  <file name>

which would give you something  like:

<file name> 2006-03-18 16:26:17.000000000 -0800


Or perhaps just use

ls -ltr

which will give you a sorted list of files in the current directory with the oldest first.


--R
------------------------------------------------------------------------
/I got Freedom,...I got freedom in my code (FC3/FC4)/
Registered Unix <http://counter.li.org> user #409453

--
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