Re: Date scripting

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

 



On 3/23/06, Chris Norman <cnorman@xxxxxxxxxxxxx> 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?
>

If you use the following command
stat -c %y filename
it will return the last modified time stamp only for a file.
Compare that to the current date using the date command
You could parse out the date either using the awk command, or simply
using string manipulation (I forget the syntax off hand, but I have it
in my notebook at work).
Wouldn't be a particularly difficult thing to do.

If you aren't certain how to go about it simply give me a few more
details and I can have a look at my notes tomorrow and bang a piece of
bash script (I'm assuming you are looking to do this in bash) to
incorporate into your existing script.

Jacques B.

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