From: Kalpesh Patel on 29 Jun 2010 05:03 I am using Net::SCP to download/upload file. I am doing like this... ---- require 'net/scp' session = Net::SCP.start("10.10.10.10", "username", :password => "password", :config => false) sess.download! "/tmp/test.txt", "/root/" ---- It works well when the source machine is linux and path is like "/tmp/test.txt". What if the source machine is Windows? My path would be something like "C:\temp\test.txt" but it does not work. It throws error "No such file or directory". Any idea how can I do that? Also, the password I give in the start function above is in plain text. How can I encrypt it and pass it with the function? Thanks much, -Kalpesh -- Posted via http://www.ruby-forum.com/.
From: Tom Copeland on 29 Jun 2010 07:44 On Jun 29, 2010, at 5:03 AM, Kalpesh Patel wrote: > I am using Net::SCP to download/upload file. I am doing like this... > > ---- > require 'net/scp' > session = Net::SCP.start("10.10.10.10", "username", :password => > "password", :config => false) > sess.download! "/tmp/test.txt", "/root/" > ---- > > It works well when the source machine is linux and path is like > "/tmp/test.txt". What if the source machine is Windows? My path would be > something like "C:\temp\test.txt" but it does not work. It throws error > "No such file or directory". Any idea how can I do that? Check out Tempfile: http://www.ruby-doc.org/stdlib/libdoc/tempfile/rdoc/classes/Tempfile.html Yours, Tom
From: uwe on 29 Jun 2010 14:15 [Note: parts of this message were removed to make it a legal post.] Make sure your backslashes don't generate tab characters. Use single quotes or escape the backlashes with extra backslash. Sent from my HTC ----- Reply message ----- From: "Kalpesh Patel" <kalpesh_patel(a)intuit.com> Date: Tue, Jun 29, 2010 11:03 Subject: Net::SCP download from windows to linux and encrypt password To: <ruby-talk(a)ruby-lang.org> I am using Net::SCP to download/upload file. I am doing like this... ---- require 'net/scp' session = Net::SCP.start("10.10.10.10", "username", :password => "password", :config => false) sess.download! "/tmp/test.txt", "/root/" ---- It works well when the source machine is linux and path is like "/tmp/test.txt". What if the source machine is Windows? My path would be something like "C:\temp\test.txt" but it does not work. It throws error "No such file or directory". Any idea how can I do that? Also, the password I give in the start function above is in plain text. How can I encrypt it and pass it with the function? Thanks much, -Kalpesh -- Posted via http://www.ruby-forum.com/.
From: Kalpesh Patel on 30 Jun 2010 03:16 Thanks for the response. I wanted to know if I can use windows like path in SCP or not. Can I use something like “sess.download! 'C:\myfile.jpg', '/root/'”? In fact, I tried this but it does not work. Any idea? -Kalpesh Uwe Kubosch wrote: > Make sure your backslashes don't generate tab characters. Use single > quotes or escape the backlashes with extra backslash. > > Sent from my HTC > > ----- Reply message ----- > From: "Kalpesh Patel" <kalpesh_patel(a)intuit.com> > Date: Tue, Jun 29, 2010 11:03 > Subject: Net::SCP download from windows to linux and encrypt password > To: <ruby-talk(a)ruby-lang.org> > > I am using Net::SCP to download/upload file. I am doing like this... > > ---- > require 'net/scp' > session = Net::SCP.start("10.10.10.10", "username", :password => > "password", :config => false) > sess.download! "/tmp/test.txt", "/root/" > ---- > > It works well when the source machine is linux and path is like > "/tmp/test.txt". What if the source machine is Windows? My path would be > something like "C:\temp\test.txt" but it does not work. It throws error > "No such file or directory". Any idea how can I do that? > > Also, the password I give in the start function above is in plain text. > How can I encrypt it and pass it with the function? > > Thanks much, > -Kalpesh -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: editing text using $EDITOR from program Next: String Spliting/CSV question |