This is a read-only archive!

10-line Ruby FTP client

An example of why I like Ruby. This could be shortened further.

#!/usr/bin/ruby

require 'net/ftp'

ftp = Net::FTP.new(*ARGV)

while ! ftp.closed? do
    begin
        puts ftp.send(* STDIN.gets.strip.split(/\s+/))
    rescue
        puts "Command failed, oops."
    end
end
November 07, 2006 @ 1:46 PM PST
Cateogory: Programming
Tags: Ruby