Re: Re: Opposite of cp -u

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



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

-- 

rgds
Stephen
_______________________________________________
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