2

I want to download files from a site, but I want to exclude specific directories. I am using the following command:

wget --user="xxxx" --password="xxx" -r -np -nH --cut-dirs=7 \
  --reject "index.html*" --exclude-directories=/abc/xyz/pqr/a \
  https://www.ftpsite.com/abc/xyz/pqr/

Under the pqr/ directory there are 3 directories, out of which I want to exclude directory a.

But using the above command, it downloads all 3 directories even after specifying the exclude-directory option.

5
  • what happens if you specify the directories using relative paths instead of absolute?
    – Jakuje
    Aug 23, 2015 at 11:07
  • @Jakuje even if after specifying --exclude-directories=/a , i got same result.
    – AVJ
    Aug 23, 2015 at 12:40
  • relative is without the leading /.
    – Jakuje
    Aug 23, 2015 at 12:41
  • @Jakuje same result by using --exclude-directories=a
    – AVJ
    Aug 23, 2015 at 14:02
  • What happens if you use the fully qualified domain name in the exclusion? https://www.ftpsite.com/abc/xyz/pqr/a/*
    – Fabby
    Aug 23, 2015 at 18:08

1 Answer 1

1

I got the solution. Actually command mentioned in question works properly.... Problem was: when space is there in URL then after entering URL space was getting converted to '%20' character.

I was using same URL with '%20' character to download using wget. Download was successful with '%20' character...But --exclude-directories wasn't working with '%20', so I replaced %20 with space(' ') and it worked...

Anyway thanks for your help and suggestions provided in comments.

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.