FBSD equivalent to Linux cp -u

Charles Howse chowse at charter.net
Sat Sep 6 05:00:57 PDT 2003


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

Thanks, Lowell.  Once again I've had an attack of the dumb-ass!  :-)




More information about the freebsd-questions mailing list