Start_command SCP did not finish successfully (1) (Net::SC

Hello,
I have a cool small script, but for unknown to me reasons it crashes:

require 'net/scp'
require 'find'
require 'fileutils'

REMOTE_ROOT = "/home/rails/uptest"
HOST = 'my'
USER = 'rails'
PASS = 'secret'

EXTENTIONS = ["jpg"]

def uploadable?(path)
  EXTENTIONS.include? File.basename(path)[-3..-1].to_s.downcase
end

Net::SCP.start(HOST,USER, :password => PASS) do |scp|
  Find.find('./') do |path|
    path = File.expand_path(path)
    if !File.directory?(path) and uploadable?(path)
      upload_path = File.join(REMOTE_ROOT, path.to_s[2..-1])
      puts "#{path} -> #{upload_path}"
      scp.upload!( path, upload_path )
    end
  end
end

The error log is:

c:/ruby/lib/ruby/gems/1.8/gems/net-scp-1.0.0/lib/net/scp.rb:351:in
`start_command': SCP did not finish successfully (1) (Net::SCP::Error)
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/channel.rb:585:in
`call'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/channel.rb:585:in
`do_close'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:548:in
`channel_close'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:428:in
`send'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:428:in
`dispatch_incoming_packets'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:185:in
`preprocess'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:169:in
`process'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:133:in
`loop'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:133:in
`loop_forever'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:133:in
`loop'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-ssh-2.0.1/lib/net/ssh/connection/session.rb:90:in
`close'
  from
c:/ruby/lib/ruby/gems/1.8/gems/net-scp-1.0.0/lib/net/scp.rb:204:in
`start'

Any ideas whats wrong?

Cheers,
Tomasz

···

--
Posted via http://www.ruby-forum.com/.

Hello again,
I have found on Infoq some exampel code to do the upload iwth sftp.
All works fine but now the uploaded jpg files are all incomplite.

I have put thise here: http://www.selleo.com/linus/sftp/

What could be the problem? I am doing ti whith

sftp.upload!(local_file, remote_file)

Cheers,
Tomasz

···

--
Posted via http://www.ruby-forum.com/.