Ruby 3.0.0 リファレンスマニュアル > ライブラリ一覧 > net/ftpライブラリ > Net::FTPクラス

class Net::FTP

クラス・モジュールの継承リスト: Net::FTP < Object < Kernel < BasicObject

要約

FTP を実装したクラスです。

特異メソッド

定義 説明
default_passive -> bool

FTPの接続のグローバルなデフォルトモードが passive mode である場合に true を返します。

default_passive=(on)

passive mode をFTPの接続のグローバルなデフォルトモードにするかどうかを設定します。

new(host = nil, user = nil, passwd = nil, acct = nil) -> Net::FTP

新しい Net::FTP のインスタンスを生成します。

open(host, user = nil, passwd = nil, acct = nil) -> Net::FTP
open(host, user = nil, passwd = nil, acct = nil) {|ftp| ... } -> object

新しい Net::FTP インスタンスを生成します。

インスタンスメソッド

定義 説明
abort -> String

データの転送を中止します。

acct(account) -> nil

サーバーに ACCT コマンドでアカウント情報を送ります。

binary -> bool

Net::FTP#put, Net::FTP#get による転送をバイナリモード(IMAGE)で行うかどうかを返します。

binary=(bool)

Net::FTP#put, Net::FTP#get による転送をバイナリモード(IMAGE)で転送するかどうかを指定します。

chdir(dirname) -> nil

リモートサーバでのカレントディレクトリを dirname に変更します。

close -> ()

サーバとの接続を切ります。

closed? -> bool

接続が切れている時に真を返します。

connect(host, port = FTP_PORT) -> ()

host で指定されたホストに接続します。

debug_mode -> bool

デバッグモードであれば真を、そうでなければ偽を返します。

debug_mode=(boolean)

デバッグモードの on/off を設定します。

delete(filename) -> nil

ファイルを削除します。

list(*args) -> [String]
list(*args) {|line| ... } -> nil
ls(*args) -> [String]
ls(*args) {|line| ... } -> nil
dir(*args) -> [String]
dir(*args) {|line| ...} -> nil

LIST コマンドを送信し、結果を返します。

get(remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) -> nil
get(remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) { |data| .... } -> nil

サーバ上のファイルを取得します。

getbinaryfile(remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) {|data| ...} -> nil
getbinaryfile(remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) -> nil

サーバ上のファイルをバイナリモードで取得します。

pwd -> String
getdir -> String

カレントディレクトリを返します。

gettextfile(remotefile, localfile = File.basename(remotefile)) -> nil
gettextfile(remotefile, localfile = File.basename(remotefile)) {|line| ...} -> nil

サーバ上のファイルをテキストモードで取得します。

help(arg = nil) -> String

サーバからの help 情報を返します。

last_response -> String

サーバからの最後の応答を文字列で返します。

lastresp -> String
last_response_code -> String

サーバからの最後の応答のコードを文字列で返します。

login(user = "anonymous", passwd = nil, acct = nil) -> ()

ホストへのログイン処理を行ないます。

mdtm(filename) -> String

MDTM コマンドを送信し、結果を返します。

mkdir(dirname) -> String

リモートサーバ上にディレクトリを作成します。

mlsd(pathname = nil) -> [Net::FTP::MLSxEntry]
mlsd(pathname = nil) {|entry| ... } -> ()

pathname で指定したディレクトリに含まれているファイルの詳細な情報を得ます。

mlst(pathname = nil) -> Net::FTP::MLSxEntry

pathname で指定したファイル/ディレクトリの詳細な情報を得ます。

mtime(filename, local = false) -> Time

filename の更新時刻を Time オブジェクトで返します。

nlst(dir = nil) -> [String]

dir で指定したディレクトリのファイルの配列を返します。

noop -> nil

NOOP コマンドを発行します。

open_timeout -> Numeric|nil

接続時のタイムアウトの秒数を返します。

open_timeout=(seconds)

接続時のタイムアウトの秒数を設定します。

passive -> bool

passive モードであるならば真を、そうでなければ偽を返します。

passive=(bool)

passive モードを設定します。

put(localfile, remotefile = File.basename(localfile), blocksize = DEFAULT_BLOCKSIZE) -> nil
put(localfile, remotefile = File.basename(localfile), blocksize = DEFAULT_BLOCKSIZE) { |data| .... } -> nil

サーバへファイルを転送します。

putbinaryfile(localfile, remotefile = File.basename(localfile), blocksize = DEFAULT_BLOCKSIZE) -> nil
putbinaryfile(localfile, remotefile = File.basename(localfile), blocksize = DEFAULT_BLOCKSIZE) {|data| ...} -> nil

サーバにファイルをバイナリモードで転送します。

puttextfile(localfile, remotefile = File.basename(localfile)) -> nil
puttextfile(localfile, remotefile = File.basename(localfile)) {|line| ... } -> nil

サーバにファイルをテキストモードで転送します。

quit -> nil

FTP のセッションからログアウトします。

read_timeout -> Numeric|nil

読み込み一回でブロックしてよい最大秒数を返します。

read_timeout=(seconds)

読み込み一回でブロックしてよい最大秒数を設定します。

rename(fromname, toname) -> nil

ファイルをリネームします。

resume -> bool

現在のリジュームモードの状態を返します。

resume=(boolean)

現在のリジュームモードを設定します。

retrbinary(cmd, blocksize, rest_offset = nil) -> nil
retrbinary(cmd, blocksize, rest_offset = nil) {|data| ...} -> nil

サーバーに cmd で指定されたコマンドを送り、バイナリデータを取り寄せます。

retrlines(cmd) {|line| ...} -> nil

サーバーに cmd で指定されたコマンドを送り、テキストデータを取り寄せます。

return_code -> String

このメソッドは obsolete です。使わないでください。

return_code=(string)

このメソッドは obsolete です。使わないでください。

rmdir(dirname) -> nil

リモートサーバ上のディレクトリを削除します。

sendcmd(cmd) -> String

cmd で指定されたコマンドをサーバーに送り、サーバーからの応答を返します。

set_socket(sock, get_greeting = true) -> nil

FTP のコントロール接続のソケットを TCPSocket オブジェクト sock に設定します。

site(arg) -> nil

SITE コマンドを発行します。

size(filename) -> Integer

リモートサーバ上のファイルのサイズを返します。

status -> String

現在の状態を返します。

storbinary(cmd, file, blocksize, rest_offset = nil) -> nil
storbinary(cmd, file, blocksize, rest_offset = nil) {|data| ...} -> nil

サーバーに cmd で指定されたコマンドを送り、バイナリデータを送ります。

storlines(cmd, file) -> nil
storlines(cmd, file) {|line| ...} -> nil

サーバーに cmd で指定されたコマンドを送り、テキストデータを送ります。

system -> String

サーバーの OS のタイプを返します。

voidcmd(cmd) -> nil

cmd で指定されたコマンドをサーバーに送ります。

welcome -> String

サーバのウェルカムメッセージを返します。

定数

定義 説明
DEFAULT_BLOCKSIZE -> Integer

get, put をするときのデフォルトのブロックサイズです。

FTP_PORT -> Integer

FTPのデフォルトのポート番号(21)です。

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined !~ <=> == === =~ _dump class clone define_singleton_method display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy inspect instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods taint tainted? tap then to_a to_ary to_hash to_int to_io to_proc to_regexp to_s to_str trust untaint untrust untrusted? .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_ENGINE_VERSION ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING