How do I upload a file using Curl FTP on MacOS?

0

Need help with curl FTP upload--going bonkers. Here's the code:

curl -T -g /Users/myaccount/Documents/xxx/xxx_Finals_Weekly/xxx_2020-03-02/XX_XXXXX+xxxxx_xxxxxxx[7]/20200302_xxx.mp3 ftp://myuser:mypass@thewebsite.com/thespecificfolder/

Here's the errors I'm receiving:

curl: (3) [globbing] bad range in column 98
curl: (7) Failed to connect to thewebsite.com port 21: Operation timed out

Not sure what I'm doing wrong--I'm using the -g option to take off globbing but I'm still getting the globbing error? Confused. Also, I don't know why the operation is timing out. Is my syntax correct here?

nwood21

Posted 2020-01-31T18:11:47.477

Reputation: 1

Okay, latest version confirmed. Still getting this error: curl: (28) Failed to connect to mywebsite.com port 21: Operation timed out

Does this have something to do with encryption? FileZilla works fine...stumped. – nwood21 – 2020-01-31T21:12:26.613

Answers

0

Install the latest curl version, perhaps via Homebrew. You're running into a bug that's been fixed in some later version of curl than the one that's included with your version of macOS.

(Tip: when asking technical questions, always include exact versions of the pieces involved. It often helps!)

I can't speak to macOS Catalina 10.15.x, but as of macOS Mojave 10.14.6, macOS's built-in curl appears to be 7.54.0 from 2017, whereas the latest version available from the official site curl.haxx.se as of this writing is 7.68.0 from January 2020. I reproduced your problem with my system's built-in 7.54.0, and then installed 7.68.0 via Homebrew and demonstrated that the problem had been fixed.

I was not able to find a particular reference to this fix in the public change log, but I didn't search through the full git commit history either.

Spiff

Posted 2020-01-31T18:11:47.477

Reputation: 84 656

Thanks. So I did the curl upgrade command--kind of interesting it still says I'm running curl 7.54.0 — even though it upgraded to curl 7.68. It says "If you need to have curl first in your PATH run: echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.bash_profile

So if I'm simply running this as a command how do I point it to the right version of Curl? What about in a Bash script? – nwood21 – 2020-01-31T20:21:08.423

@nwood21 Yes, Homebrew does not replace the system versions, because that could break the OS. Instead it installs stuff as alternatives to the system versions. If you want to run the Homebrew-installed alternatives, you have to put those directories earlier in your PATH environment variable. The command you sited from Homebrew's curl install process will put a line in your ~/.bash_profile (bash shell startup script) to make that change. Using a shell / terminal often requires managing shell startup scripts and your PATH, but that's beyond the scope of this comment. – Spiff – 2020-01-31T20:36:48.963