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?

link|improve this question
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 '09 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 '10 at 16:04
feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.