Skip to content
Tag

Ftp

Articles and publications tagged Ftp across the Atmosphere.

4articles4publications
ばうあーろぐ
ばうあーろぐ
Sep 3, 2016
FTP でも rsync みたいにコマンドからファイル転送したい
ターミナルで何でも行う人にとって、FTP の GUI クライアントはもう辛すぎるのです。 コマンド1つで rsync のようにアップロードしたいのです。 同じように考える人は多いらしく、 “rsync”, “FTP” でググると “rsync over FTP” がどうのこうのと書かれた記事は散見するものの、 そんなものないけど、代わりに lftp 使うといいよ。みたいな記事が多くあります。 なので、(過去に1度使った記憶あるものの、改めて)試しに使ってみました。 なお、MacBook Pro の El Capitan です。Homebrew でインストールします。 brew install lftp man lftp lftp コマンドは、基本的に ftp コマンドと同じく対話形式のコマンドなのですが、 オプションで -e や -c とともに対話形式の内容のコマンド(サブコマンド?)をつけてやると そのまま実行できます。 また、対話形式をテキストファイルにまとめておき、 -f オプションで利用することも可能です。 以下は lftp コマンド自体のシンタックスとオプションです。(man lftp より抜粋) SYNTAX lftp [-d] [-e cmd] [-p port] [-u user[,pass]] [site] lftp -f script_file lftp -c commands lftp --version lftp --help OPTIONS -d Switch on debugging mode. -e commands Execute given commands and don't exit. -p port Use the given port to connect. -u user[,pass] Use the given username and password to connect. Remember to quote the password properly in the shell. Also note that it is not secure to specify the password on command line, use ~/.netrc file or LFTP_PASSWORD environment variable together with --env-password option. Alternatively you can use ssh-based pro- tocols with authorized keys, so you don't have to enter a pass- word. --norc Don't execute rc files from the home directory. -f script_file Execute commands in the file and exit. This option must be used alone without other arguments (except --norc). -c commands Execute the given commands and exit. Commands can be separated with a semicolon, `&&' or `||'. Remember to quote the commands argument properly in the shell. This option must be used alone without other arguments (except --norc). 上記から、接続情報は lftp のオプションとして渡しつつ、 それとは別に対話形式内のコマンドにて実際のファイルアップロードを行います。
FTPrsync

You've reached the end.