Pages

sftp recursive option not working, solution?!!

That was really unexpected invoking sftp (which is come with openssh client) was obviously straight forward, but unexpectedly  recursive option didn't work at least as documented :)

after digging a bit with the source code, this error seems to show when the path isn't exists, but when I created the path for the sftp program, it never complains

lets review how to invoke sftp:
with its simplest form

sftp  server-user@server
Connected server.
sftp> lpwd
Local working directory: /home/server-user
sftp> ls
old 
sftp> put -r test
Uploading test/ to /home/server-user/test
Couldn't canonicalise: No such file or directory
Unable to canonicalise path "/home/server-user/test"
sftp> 


this is the problem so what the solution:
well lets    mkdir test  in remote server and see if it works or not

sftp>; put -r test

Uploading test/ to /home/server-user/test
test/f4                                                          100%    0     0.0KB/s   00:00  
test/f3                                                          100%    0     0.0KB/s   00:00  
Entering test/a
Entering test/a/b
Entering test/a/b/b
Entering test/a/b/b/g
Entering test/a/b/b/g/y
Entering test/a/b/b/g/y/r
Entering test/1
Entering test/1/2
Entering test/1/2/3
Entering test/1/2/3/4
Entering test/1/2/3/4/5
Entering test/1/2/3/4/5/6
test/f5                                                          100%    0     0.0KB/s   00:00  
test/f2                                                          100%    0     0.0KB/s   00:00  
Entering test/test.d
Entering test/test.d/dir1
test/test.d/file2                                                100%    0     0.0KB/s   00:00  
Entering test/test.d/dir3
test/test.d/dir3/file2                                           100%    0     0.0KB/s   00:00  
test/test.d/dir3/file1                                           100%    0     0.0KB/s   00:00  
test/test.d/dir3/file4                                           100%    0     0.0KB/s   00:00  
test/test.d/dir3/file3                                           100%    0     0.0KB/s   00:00  
test/test.d/file1                                                100%    0     0.0KB/s   00:00  
test/test.d/file4                                                100%    0     0.0KB/s   00:00  
test/test.d/file3                                                100%    0     0.0KB/s   00:00  
Entering test/test.d/dir2
test/f1                                                          100%    0     0.0KB/s   00:00  
sftp>







see it works, only you need to make a directory in the server with the same name of the folder you are uploading recursively and hopefully thats it :)



No comments:

Post a Comment