Using wget to download select directories from ftp server

Viewed 18918

I'm trying to understand how to use wget to download specific directories from a bunch of different ftp sites with economic data from the US government.

As a simple example, I know that I can download an entire directory using a command like:

wget  --timestamping  --recursive --no-parent ftp://ftp.bls.gov/pub/special.requests/cew/2013/county/

But I envision running more complex downloads, where I might want to limit a download to a handful of directories. So I've been looking at the --include option. But I don't really understand how it works. Specifically, why doesn't this work:

wget --timestamping --recursive -I /pub/special.requests/cew/2013/county/ ftp://ftp.bls.gov/pub/special.requests/cew/

The following does work, in the sense that it downloads files, but it downloads way more than I need (everything in the 2013 directory, vs just the county subdirectory):

wget --timestamping --recursive -I /pub/special.requests/cew/2013/ ftp://ftp.bls.gov/pub/special.requests/cew/

I can't tell if i'm not understanding something about wget or if my issue is with something more fundamental to ftp server structures.

Thanks for the help!

2 Answers
Related