Re: Opposite of cp -u

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



Stephen Harris wrote:
On Mon, Aug 06, 2007 at 06:27:20PM -0500, Robert Nichols wrote:
    for F in *
    do  cmp "$F" "/new/directory/$F" && touch -r "$F" "/new/directory/$F"
    done

That will compare all the files and adjust the timestamp on the files
that are still the same as those on the backup.  Note that, despite
the quoting, the script will break if any of the filenames have embedded
whitespace because the "for F in *" will be parsed incorrectly.

Not in a sane shell.  Heh, not even in bash :-)

  bash-2.05b$ touch "a b"
  bash-2.05b$ touch c
  bash-2.05b$ touch d
  bash-2.05b$ ls
  a b  c  d
  bash-2.05b$ for a in *
  > do
  > echo Result is: $a
  > done
  Result is: a b
  Result is: c
  Result is: d

OK.  Color me paranoid, or maybe "once burned, twice shy."

--
Bob Nichols     "NOSPAM" is really part of my email address.
                Do NOT delete it.

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux