Fred James wrote,
>Neil Parker wrote:
>>     xargs -i scp '[EMAIL PROTECTED]:{}' here/ <list-of-files
>I was able to get satisfactory results from this one by added \" in four 
>places (see below) - granted my testing was all local.  Does it behave 
>differently when copying from remote?
>Regards
>Fred James
>
>#! /bin/sh
>#       fubar3.sh
>#
>fileName="fubar"
>xargs -i scp \"'{}'\" \"'{}'\".new < $fileName
>exit

Hmm...I wouldn't think extra quotes would be needed at all on the local side.
But it didn't occur to me that the remote side might need an extra set of
quotes to protect spaces.

The way I usually handle scp'ing files with funny characters in the name
is to rename them before copying them.  If there's too many files for
that, archive on the remote side, scp the archive, and unpack it locally.
I haven't had much luck directly scp'ing files with funny characters in
the name.

I just tested this with a file with spaces in its name, and it seems to
work:

     xargs -i scp [EMAIL PROTECTED]:'"{}"' here <list-of-files

This uses the outer single quotes to protect both the inner double quotes
and the braces, which looks much nicer than all those backslashes.  It
would probably choke on a file with a double-quote in its name...if that's
a problem, perhaps something like this would help:

     sed -e 's/"/\\"/g' <list-of-files|xargs -i scp [EMAIL PROTECTED]:'"{}"' 
here

               - Neil Parker
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to