Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Curl to download and upload same file simultaneously

Not sure if it's possible but I've been trying to use curl to essentially download a file from a HTTP location and output it onto an FTP server. I would really like some help if this is in fact possible.

like image 935
Andrew Hunt Avatar asked Feb 02 '11 22:02

Andrew Hunt


1 Answers

curl http://example.com/down | curl -T - ftp://mysite.org/up

By default curl spits its output to stdout - we then pipe that into another instance of curl.

On the second instance, -T tells curl to upload a file, and the - tells it to take the file data from stdin (rather than from a file on disk).

like image 77
Anon. Avatar answered Sep 28 '22 18:09

Anon.