1
Vote

problem with transfer all the folder with / in the name

description

I Have a huge problem... i create a sftp connection (sharpssh.jsch) with our library to create a backup of my files on my iphone... so i have to transfert an entire folder but with your library we can't(could be a great new feature the chance to transfer an entire folder automatically like winscp does) so i have to parse file by file the folder.. but some folder in iphone have the '/' in the name and i can't find a way to trasfer it.. i try to leave the single '/'... use like winscp does the double '//' no luck... how can i solve? please help me :(

comments

icnocop wrote Nov 5, 2009 at 9:58 PM

What does your code look like?
What exactly does .GetFileList return?

phate89 wrote Nov 5, 2009 at 11:12 PM

this is my code:
        Dim JSchs As JSch = New JSch()
        Dim Sessions As Session = JSchs.getSession(UserName.Text, IP.Text, 22)
        Dim ui As UserInfo = New MyUserInfo(Password.Text)
        Sessions.setUserInfo(ui)
        Try
            Sessions.connect()
            Sessions.setPassword(Password.Text)
        Catch ex As JSchException
            MessageBox.Show("Errore! " & ex.toString, "Errore!")
            Exit Sub
        End Try
        Dim Channels As Channel = Sessions.openChannel("sftp")
        Channels.connect()
        Dim c As ChannelSftp = CType(Channels, ChannelSftp)
                c.get("path with / in the name of the folder", "c:\backup")
            Catch ex As SftpException
                If Not ex.id = 2 Then
                    MsgBox(ex.message)
                End If
            End Try
naturally if i try to get the name of the folder with slash it tooks me the right name... for example if the name of the folder is 'name/folder' contained in the /private/var folder if i parse the folder with ls command of channelsftp it tooks the right string ("name/folder") the problem is when i take the file with get command! he don't find the "/private/var/name/folder" and neither the "/private/var/name//folder"...how can i get files from that folder?!?!?

icnocop wrote Nov 6, 2009 at 2:50 AM

I would try iterating through c.GetFileList and then doing a c.get on files instead of trying to do a c.get on a folder.
What error message do you get?

phate89 wrote Nov 8, 2009 at 4:53 PM

if i do .GetFIleList("/dat/") returns an sftpexception with message no such file... same thing if i call .GetFIleList("/dat//")... the folder is named dat/ and is in the root folder

icnocop wrote Nov 9, 2009 at 3:49 AM

have you tried
c.get("path with / in the name of the folder", "c:\backup")
Notice the "\" in "c:\backup"

What is the exact error message \ exception (including stack trace) you are getting?

phate89 wrote Nov 9, 2009 at 10:49 AM

yes sure the problem is in that folder in the ssh connection not in my computer because if i do the same thing with a normal folder works

phate89 wrote Nov 13, 2009 at 8:22 PM

no news?:(

wrote Feb 14, 2013 at 12:17 AM