Hi, +-From: Rajendra Prasad <rajenkpra...@gmail.com> -- |_Date: Thu, 21 Jan 2010 07:11:51 -0600 ___________ | |We contacted technical support people and they told like we cannot append |user working directory path (/home/XXXXX) at the beginning of the remote |directory path if the path is not having "/" at the beginning. Instead of |that they suggested like if we can place "./" (where "." represents the |current working directory) will help us to send the file to the destination |server through router server.
The draft document[1] for sftp protocol says as follows, >6. File Names > This protocol represents file names as strings. File names are > assumed to use the slash ('/') character as a directory separator. > File names starting with a slash are "absolute", and are relative to > the root of the file system. Names starting with any other character > are relative to the user's default directory (home directory). Note > that identifying the user is assumed to take place outside of this > protocol. So, your code will change the result if the current working directory is not a home directory. >> Is it possible for you to change the logic as follows? >> private String remoteAbsolutePath(String s) throws SftpException { >> if((s.charAt(0) == '/') || (s.charAt(0) == '.')) >> return s; >> String s1 = getCwd(); >> if(s1.endsWith("/")) >> return s1 + s; >> else >> return s1 + "/" + s; >> } >> How about the following change? private String remoteAbsolutePath(String s) throws SftpException { if((s.charAt(0) == '/')) return s; String s1 = getCwd(); if(s1.equals(getHome())) return s; if(s1.endsWith("/")) return s1 + s; else return s1 + "/" + s; } I have not tried it yet, but if you do not change the directory from your home directory, you can specify the filename what you want. [1] http://tools.ietf.org/id/draft-ietf-secsh-filexfer-13.txt Sincerely, -- Atsuhiko Yamanaka JCraft,Inc. 1-14-20 HONCHO AOBA-KU, SENDAI, MIYAGI 980-0014 Japan. Tel +81-22-723-2150 +1-415-578-3454 Skype callto://jcraft/ Twitter: @ymnk ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users