FTP転送
FTP -File Transfer Protocol- コマンド
ファイル転送を行うコマンド。FTP.EXE は最低限の機能しかない。
コマンドラインオプション
C:\>ftp -h
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host]
-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-w:buffersize Overrides the default transfer buffer size of 4096.
host Specifies the host name or IP address of the remote
host to connect to.
Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
バッチによるFTP転送
バッチファイル内で FTP.EXE を利用し、ファイル転送を自動的に行う方法です。ポイントは、FTPで入力するサブコマンドをプレーンテキストに順に記述し、FTP.EXE にスクリプトとして渡し実行します。
※実行コマンド ftp -s:ftpbat.txt > ftpbat.log
※FTPコマンドファイル(ftpbat.txt) open 10.10.10.10 USERNAME PASSWORD cd dev/src/sumple/ ascii put sumple.c bye
有効なのはWindowsに付属のFTP.EXEのみ(UNIXは標準入力で渡す)。サーバ側は特に制限はない。パスワードをプレーンテキストにそのまま書くので、セキュリティには注意すること。
また、記述したFTPコマンドが成功しているかを ERRORLEVEL で判断することは出来ない(常に 0 が返ってくる)。
最終更新時間:2012年12月07日 13時19分41秒 指摘や意見などあればSandBoxのBBSへ。