FTP - Download multiple files using ruby

Please support our Ruby advertiser: SELL YOUR PRODUCT TODAY !
Reply

Join Date: Apr 2009
Posts: 2
Reputation: shekarls is an unknown quantity at this point 
Solved Threads: 0
shekarls shekarls is offline Offline
Newbie Poster

FTP - Download multiple files using ruby

 
0
  #1
Apr 15th, 2009
I have written ftp code which will download a single file from the
Server using the below code:

  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Ruby Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC