2006年06月13日

curlでお手軽FTP PUT

livedoorClipに登録 | このエントリーをはてなブックマークに追加 | del.icio.usに登録 | MM/Memoに登録

『wgetやfetchのように手軽にftp putしたい』と思った。


$ curl -u [user]:[pass] -T [file] ftp://[host]/
$ curl -u [user]:[pass] -T [file] ftp://[host]/[path]


これで行けた


$ man curl
-T/--upload-file
This transfers the specified local file to the remote URL. If
there is no file part in the specified URL, Curl will append the
local file name. NOTE that you must use a trailing / on the last
directory to really prove to Curl that there is no file name or
curl will think that your last directory name is the remote file
name to use. That will most likely cause the upload operation to
fail. If this is used on a http(s) server, the PUT command will
be used.

Use the file name "-" (a single dash) to use stdin instead of a
given file.

You can specify one -T for each URL on the command line. Each -T
+ URL pair specifies what to upload and to where. curl also sup-
ports "globbing" of the -T argument, meaning that you can upload
multiple files to a single URL by using the same URL globbing
style supported in the URL, like this:

curl -T "{file1,file2}" http://www.uploadtothissite.com

or even

curl -T "img[1-1000].png" ftp://ftp.picturemania.com/upload/



トラックバックURL

この記事にコメントする

名前:
URL:
  情報を記憶: 評価: 顔