Skip site navigation (1)Skip section navigation (2)
Date:      05 Sep 2003 23:10:47 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.no-ip.com>
To:        "Charles Howse" <chowse@charter.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FBSD equivalent to Linux cp -u
Message-ID:  <44ad9i4nns.fsf@be-well.ilk.org>
In-Reply-To: <000901c373fa$43007eb0$04fea8c0@moe>
References:  <000901c373fa$43007eb0$04fea8c0@moe>

next in thread | previous in thread | raw e-mail | index | archive | help
"Charles Howse" <chowse@charter.net> writes:

> I have read man cp, and I don't see a way to copy source file to
> destination file *only* if source file is newer than destination file.
> 
> In Linux, I could do cp -u.  Is there another utility that can pull this
> off?

In sh(1), it should be as simple as:

 if [ $sourcefile -nt $destinationfile ] ; 
  then 
    cp -p $sourcefile $destinationfile ; 
 fi

[untested]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44ad9i4nns.fsf>