Type:
Class
Constants:
MDTM_REGEXP : /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/

This class implements the File Transfer Protocol. If you have used a command-line FTP program, and are familiar with the commands, you will be able to use this class easily. Some extra features are included to take advantage of Ruby's style and strengths.

Example

require 'net/ftp'

Example 1

ftp = Net::FTP.new('example.com')
ftp.login
files = ftp.chdir('pub/lang/ruby/contrib')
files = ftp.list('n*')
ftp.getbinaryfile('nif.rb-0.91.gz', 'nif.gz', 1024)
ftp.close

Example 2

Net::FTP.open('example.com') do |ftp|
  ftp.login
  files = ftp.chdir('pub/lang/ruby/contrib')
  files = ftp.list('n*')
  ftp.getbinaryfile('nif.rb-0.91.gz', 'nif.gz', 1024)
end

Major Methods

The following are the methods most likely to be useful to users:

chdir

chdir(dirname) Instance Public methods Changes the (remote) directory.

2015-04-20 13:13:49
size

size(filename) Instance Public methods Returns the size of the given (remote)

2015-04-20 15:28:36
ls

ls(*args) Instance Public methods Alias for:

2015-04-20 14:13:46