8

Basically, I'm trying to do this:

some_other_program | curl ftp://username:password@192.168.1.10/file.txt

As a test case to see if I can get it working, I'm trying it with cat like so:

cat test.txt | curl -d @- ftp://admin:PASS@192.168.1.10/file.txt

Notice, I tried the -d @- thing, but it doesn't work. How do I do this?

This question is similar, but that one is about HTTP, my question is about FTP.

101010
  • 763

1 Answers1

9

curl's -T accepts - to read from stdin.

The command reads like:

cat test.txt | curl -T - ftp://admin:PASS@192.168.1.10/file.txt

Here's an example used to upload a file to Vimeo directly:

gsutil cp gs://my-bucket/video.mp4 - | curl -T - ftp://user:PASS@ftp-3.cloud.vimeo.com/video.mp4
bahamat
  • 39,666
  • 4
  • 75
  • 104
urish
  • 191