943,670 Members | Top Members by Rank

Ad:
  • Ruby Discussion Thread
  • Unsolved
  • Views: 3529
  • Ruby RSS
Apr 15th, 2009
0

FTP - Download multiple files using ruby

Expand Post »
I have written ftp code which will download a single file from the
Server using the below code:

Ruby Syntax (Toggle Plain Text)
  1. require 'rubygems'
  2. require 'net/ftp'
  3. require 'fileutils'
  4.  
  5. URL = 'IP address'
  6. username = 'test'
  7. passwd = "test"
  8. filename = "file1"
  9. directory = '/home/test/'
  10. localfile = 'C:\\Documents and Settings\\User1\\Desktop\\file1'
  11. ftp=Net::FTP.new
  12. ftp.connect(URL,21)
  13. ftp.login(username,passwd)
  14. ftp.chdir(directory)
  15. ftp.getbinaryfile(filename,localfile)
  16. ftp.close

But what i am really looking for is:
1) Download multiple files from a given directory.
2) Download files by giving wild characters (eg: *.xls or *.txt)

Please let me know if there is a better way or easier way to achieve
these tasks.

cheers
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shekarls is offline Offline
2 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Ruby Forum Timeline: Configure SciTE - accept keyboard inut
Next Thread in Ruby Forum Timeline: for loops (101)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC