I am trying to transfer a file that has a space in it's name and I get

scp: ambiguous target

this is the code snippet

String command="scp -p -t \"" + rfile.replace(" ", "\\ ") + "\"";
channel=session.openChannel("exec");
err.println("opening command=" + command);
((ChannelExec)channel).setCommand(command);

// get I/O streams for remote scp
out=channel.getOutputStream();
InputStream in=channel.getInputStream();

channel.connect();

if(checkAck(in)!=0)
{
        boom;
}

I added the quotes and replacing " " with "\\ " (backslash and space) to
try and escape it with no luck.  command currently evaluates to 

scp -p -t "/tmp/c3_upload/3119586_940584/assets/o/58\ shaking\ liquid\
in\ a\ can\ 2.wav"

and the problem happens in the checkAck which is directly from the
example code.  I have also tried ' to surround the filename in place of
" and no luck there either.

Things work fine for filenames that don't have a space in it.

Any suggestions would be great.  Thanks.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to