Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to get all files in a directory using curl? Here's my string so far:

curl --ftp-ssl -k ftp://user:pass@IP

This will LIST the files in the user FTP directory, how do I adjust this string to get (RETR) all files in the remote directory?

share|improve this question

AFAIK, there is no such option to download a directory with curl, so you must get the listing first and pipe it to curl to download file by file, something like this:

$ curl -s ftp://user:pass@IP/path/to/folder/ | \
    grep -e '^-' | awk '{ print $9 }' | \
        while read f; do \
            curl -O ftp://user:pass@IP/path/to/folder/$f; \
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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