Server using the below code:
Expand|Select|Wrap|Line Numbers
- require 'rubygems'
- require 'net/ftp'
- require 'fileutils'
- URL = 'IP address'
- username = 'test'
- passwd = "test"
- filename = "file1"
- directory = '/home/test/'
- localfile = 'C:\\Documents and Settings\\User1\\Desktop\\file1'
- ftp=Net::FTP.new
- ftp.connect(URL,21)
- ftp.login(username,passwd)
- ftp.chdir(directory)
- ftp.getbinaryfile(filename,localfile)
- ftp.close
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