Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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; \
        done
share|improve this answer

Your Answer

 
discard

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.