On Thu, 24 Jul 2003, Eric Jahn wrote:
> Is there a way to get timestamp info on a single directory or file
> without parsing ls -l output?  I'm trying to dynamically choose the
> backup folder depending on which is older... What would be really cool
> is an "is older than" comparison.  I couldn't find anything in the bash
> literature except ls -l stuff.  Thank you!
Well, there's the '-newer' flag to 'find'; so I guess you could do
something like:
. /usr/local/lib/untested-code
if [[ -n `find dir1 dir2 -maxdepth 0 -newer dir1` ]] then
    # dir1 is older
else if [[ -n `find dir1 dir2 -maxdepth 0 -newer dir2` ]] then
    # dir2 is older
else
    # same age
fi
... BICBW.  Try on comp.unix.shell .
-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
Are you confident that you appear to be professional in your electronic
communication?  Consider this: A: No
                               Q: Can I top post? from nick@xx.co.uk
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:55:56 EDT