10

I'd like to download a directory from a FTP, which contains some source codes. Initially, I did this:

wget -r ftp://path/to/src

Unfortunately, the directory itself is a result of a SVN checkout, so there are lots of .svn directories, and crawling over them would take longer time. Is it possible to exclude those .svn directories?

15
wget -X directory_to_exclude[,other_directory_to_exclude] -r ftp://URL_ftp_server

SERVER
    |-logs
    |-etc
    |-cache
    |-public_html
      |-images
      |-videos ( want to exclude )
      |-files
      |-audio  (want to exclude)

wget -X /public_html/videos,/public_html/audio ftp:SERVER/public_html/*
  • 1
    This actually seems to be the correct comment. The exclude-directories switch does not do patterns/regexes, so you have to include the entire path (from root). The higher-voted answer seems to be incorrect for all but the trivial cases. – John O Sep 28 '16 at 19:26
  • 1
    I agree. Although the documentation states that wildcards can be used, I could not get them to work. – Diomidis Spinellis Jan 16 '17 at 17:32
  • 1
    wildcards work, but are interpreted first on shell level, so you have to escape them to work. – Joop Kiefte Oct 1 '17 at 19:20
5
wget --exclude-directories=.svn -r ftp://path/to/src

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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