1

what is the best way to upload files parallely using sftp ?
using multithreading and multi-process is the only options ?
can we use any of the gems for that ?
I using ruby 1.8.6.

1 Answer 1

1

Net::SFTP's upload method (without bang) operates asynchronously, i.e. in parallel.

From the docs:

Or, if you have multiple uploads that you want to run in parallel, you can employ the wait method of the returned object:

uploads = %w(file1 file2 file3).map { |f|
  sftp.upload(f, "remote/#{f}")
}
uploads.each { |u| u.wait }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.