2017-12-29 65 views
1

(リモートサーバ上) 1つのコマンドラインにある可能性がありますか?ftpサーバからファイルをダウンロードして削除する必要がありますか?curlファイルのダウンロードと削除ftp

curl ftp://host/testfile.txt -X 'GET testfile.txt' --user user:password -o local.txt 
curl ftp://host/testfile.txt -X 'DELE testfile.txt' --user user:password 

おかげ

+0

コマンドをダウンロード?:それをこの方法で行う;コマンド –

+0

を削除「それは、単一のコマンドラインで可能性があります? ' –

+0

確かに試してみてください:) –

答えて

1

私はあなたのFTPコマンドのスクリプトを作成し、ビルトインftpクライアントにそれらをパイプをお勧めします。ここに私のマシン上で働いていた例(ごGET/DELコマンドでtest.ftpscriptlsコマンドを置き換え)です:

[[email protected] ~] cat > test.ftpscript user anonymous [email protected] ls bye [[email protected] ~] ftp -inv ftp.swfwmd.state.fl.us < test.ftpscript Connected to ftp.swfwmd.state.fl.us (204.76.241.31). 220 331 Please specify the password. 230 Login successful. 227 Entering Passive Mode (204,76,241,31,191,167). 150 Here comes the directory listing. -rw-r--r-- 1 0 0 7478 Dec 05 09:59 README.txt drwx------ 2 0 0 16384 Dec 04 13:40 lost+found drwxr-xr-x 20 0 0 4096 Dec 18 14:42 pub lrwxrwxrwx 1 0 0 3 Dec 05 10:07 public -> pub drwxr-xr-x 3 0 0 4096 Dec 04 15:26 pvt 226 Directory send OK. 221 Goodbye. [[email protected] ~]

関連する問題