How to move files in remote directory SFTP server

1.1k views Asked by At

I'm new to SFTP servers, I was able to read my file from remote SFTP server and able to process the data. Now my major concern is how to move the file in Archive folder in the same remote server.

I'm using Nodejs and ssh2-sftp-client to connect the server and read the files.

directory |- main |- Archive |- file.txt

Thanks in advance for the your replies.

1

There are 1 answers

0
Muhamed Salih On

There are multiple ways we can achieve the goal here is my suggestion.

  1. we can use get function to push the file from the source or buffer/stream from nodejs code to give remote path location of server [works only for small and mid level files]

  2. Kindly use nodejs native stream with stream processing to handle huge file sizes, i.e. we read, process, and write a stream.Note: ssh2-sftp-client support nodejs native stream by providing steam options to lib functions

Hope that answers, If you want additional idea reply in comments.

Regards,
Muhamed