From: Seid Rudy Date: 2006-09-15T01:56:23+09:00 Subject: Re: calling scp from ruby Seid Rudy wrote: > Pau Garcia i Quiles wrote: >> On Thursday 07 September 2006 22:29, Joel VanderWerf wrote: >>> Pau Garcia i Quiles wrote: >>> > Why won't you use Net::SFTP instead of calling the external scp? >>> >>> I can guess one reason. Net::SFTP doesn't work with key-based >>> authentication, only passwords, and there is no password given in OP's >>> code.... >>> >>> I hope that I am wrong and that this has changed recently. >> >> Actually, it works with key-based authentication: > > ---- code ------------- > require 'rubygems' > > require_gem 'net-ssh' > require_gem 'net-sftp' > > > Net::SSH.start( 'host','user','password') do |session| > session.sftp.connect do |sftp| > sftp.put_file("#{log}", "#{remotesqlfolder}/#{date_folder}.log") > end > end > ---- end of code ------ > --- error ------------- ----------------------- Even though it gave me bunch of warnings it copied the file. BUT i still have the same problem and that is it chops from the bottom of the destination file (N) bytes. i have tried `scp -r #{sql_folder} #{remotelogin}:#{remotesqlfolder}/` system("scp -r #{sql_folder} #{remotelogin}:#{remotesqlfolder}/") system "scp -r #{sql_folder} #{remotelogin}:#{remotesqlfolder}" and the aboth All have the same problem @ the same spot of the file. Does anybody got any idea i can try? -- Posted via http://www.ruby-forum.com/.