4
tbodt
6y

So i'm trying to upload a file to an SSH server using node. First I try the obvious putFile method provided by the obvious node-ssh package. On any other server this would work fine but this server doesn't have sftp installed so that doesn't work.

OK, so next I learn how scp works (it runs the command "scp -t" on the remote server, and sends to stdin a command like "C0666 1234 file.txt" and then sends the contents of the file) and I write some javascript code to do this. It's pretty finicky, the first few tries I forget to close the stream right or detect the program finishing. I add some logging and that helps me figure out what the problem is, and finally I get it to not output any errors.

So I log into the server and check and the file isn't there. I try again several times, file still isn't there. I try running scp -t manually on the server, typing in exactly what my program is sending, and it works. This goes on for a while until I realize that I've been sending a file to one server and logging into a different server to check if the file was sent. grrr

Comments
  • 3
    Do rsync instead
  • 2
    @Linux I just need to copy a file without spending a month learning which rsync flags i need
  • 2
    @tbodt

    -a

    There you go... It takes 1 minute to figure that out. Please dont touch Linux again if you are not willing to learn.
  • 2
    @Linux apparently that's the same as `-rlptgoD`. don't really want to dig deeper.

    PS: this is ios not linux, and we don't have rsync installed on these ios devices
  • 1
    Hello there guys. Can you please recommend some ftp servers right now? I need your assistance right now so help me please with this thing here.
  • 1
    Of course, guys, if you need some help with such things then I believe that you need to learn more information about turboftp here on https://www.turboftp.com/tbserver as it seems to me that this FTP and SFTP server for Windows can help you with such problems right there. I wish you good luck guys
Add Comment