Skip to content

Instantly share code, notes, and snippets.

@TAKAyukiatkwsk
Created February 28, 2014 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TAKAyukiatkwsk/9266385 to your computer and use it in GitHub Desktop.
Save TAKAyukiatkwsk/9266385 to your computer and use it in GitHub Desktop.
Net::FTPクラスを使ってみる
require 'net/ftp'
ftp = Net::FTP.new
ftp.connect('hostname', 21) # port番号はdefaultで21(省略可能)
ftp.login('username', 'password')
ftp.passive
#=> true or false
ftp.passive = true
ftp.list
#=> ["-rw-r--r-- 1 0 0 1234 Feb 27 13:36 aaa.txt",
# "-rw-r--r-- 1 0 0 2345 Aug 15 2013 bbb.txt"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment