I
Idealone Ideally
I have written ftp code which will download a single file from the
Server using the below code:
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
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
Server using the below code:
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
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