Re: rsync problem
On Tue, Jul 28, 2009 at 12:40:00AM -0700, Robert Holtzman <holtzm@cox.net> was heard to say:
> On Mon, 27 Jul 2009, Mike Bird wrote:
>
> >On Mon July 27 2009 22:59:38 Robert Holtzman wrote:
> >>
> >>Just installed rsync 3.0.3-2 and tried to backup to a usb drive using a
> >>script:
> >>
> >>rsync -vaHz --exclude '/proc' --exclude '/sys' -- exclude '*.iso'
> >>--exclude '/media' / /media/disk/laptop
> >
> >Does the space between the -- and the exclude exist in the script?
>
> Yes but it works. the problem is "--exclude '/media'".
"--" by itself often tells command-line parsers that the rest of the
arguments are to be treated as positional arguments, even if they look
like switches. rsync's manual page doesn't mention this that I could
see in a quick skim, but that's how it behaves:
$ mkdir foo
$ echo > --test
$ rsync --test foo
rsync error: syntax or usage error (code 1) at main.cc(1440) [client=3.0.6]
$ rsync -- test foo
$ ls foo
--test
So your "--exclude /media" is treated as a request to copy both
"--exclude" and "/media" to the destination.
Daniel
Reply to: