3

In a bash script, I am using curl command on linux to download files from a FTP server.

The command I am using is the following (the information about the FTP server connexion is stored in a .netrc file):

curl -v -netrc "ftp://my.ftp.server/foo/bar.txt" -o bar.txt

This is working pretty well, except that if the bar.txt is empty (size file = 0).

How do I force curl to download the file, i.e. getting a bar.txt which is empty?

2
  • If you omit the '-o' option, does it display the file to stdout? Does the file on the FTP server actually contain anything? What troubleshooting have you done?
    – EmmEff
    Sep 18, 2009 at 14:07
  • FWIW: If using netrc you need to use two dashes: --netrc. I would try to use curl --trace-ascii - --netrc "my.ftp.server/foo/bar.txt" and check the output.
    – Wolf
    Jan 18, 2010 at 16:04

1 Answer 1

1

Looks like this is a low importance bug, as stated here http://sourceforge.net/tracker/?func=detail&aid=3438362&group_id=976&atid=100976

In a script, you can check that if for an FTP/FTPS transfer the exit code is 0, but the file is not there, most probably the file from the remote server is empty.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .