Error with paths with ()'s

Kevin Korb kmk at sanitarium.net
Mon Aug 17 22:50:34 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remember that when you rsync to 10.0.0.11:/Drive5/{} rsync is going to
run: 'ssh 10.0.0.11 rsync --server /Drive5/whatever file name(s) were
in {}'

You should see the problem now.  Even if the spaces and parentheses
are quoted or escaped the ssh adds more levels of shell so they
would need more escapes.

On 08/17/2015 05:51 PM, @lbutlr wrote:
> On Aug 17, 2015, at 3:06 PM, Joe <josephj at main.nc.us 
> <mailto:josephj at main.nc.us>> wrote:
>> First, let me state the obvious. It looks like your code is 
>> executing rsync in a bash one liner once for each file that find 
>> returns. That's not cool! And it's almost definitely not what
>> you wanted to do.
> 
> It is perfect;y acceptable and definitely ‘cool’. This gives me 
> stats on each file, which is what I want.
> 
>> Among other things, that means that bash is seeing all those 
>> embedded blanks and the parentheses in your file names and 
>> getting upset because blanks delimit arguments and parentheses 
>> are used for a number of syntactically meaningful things.
> 
> That does not explain why bash is perfectly happy with the command 
> line if it is a locally mounted disk (the same disk, in fact). 
> Despite the error, this is not a bash problem.
> 
>> So, at a minimum, you need to escape/quote *both* of your file 
>> references {} - not just the one.
> 
> Find’s {} is escaped, just doesn’t seem to be escaped properly via
>  ssh/rysnc.
> 
> As I said, this works:
> 
> find . -type f -atime -1 -exec rsync -aP {} /Drive5/{}
> 
> This fails if there are ()’s in the file name.
> 
> find . -type f -atime -1 -exec rsync -aP {} 10.0.0.11:/Drive5/{}
> 
>> But the real issue is that you should probably let find put all 
>> the resulting file names into a file or pipe and send that to 
>> rsync once using something like --files-from=FILE       read
>> list of source-file names from FILE where you should be able to
>> use "-" as the file name so it uses the output of the find
>> command as input to rsync.
> 
> Hmm. Maybe. I’ll play with that.
> 
> -- Why live in the world when you can live in your head?
> 
> 
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
- -*~
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
- -*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlXSZToACgkQVKC1jlbQAQdNDgCgxevEssXjHyYAmnSaA6yZ3c6I
1oMAn1UGk0dZ46ow2aPJvSxdyVl/Dpe4
=20zf
-----END PGP SIGNATURE-----



More information about the rsync mailing list