I want to download some folders under the same directories by using wget
, here is the structure of the apache
directory.
example.com/main/eschool/PhotoAlbum/Album/2008-10-13-citieneducationcenter/
example.com/main/eschool/PhotoAlbum/Album/2009-11-12-snfkdgjndfk/
example.com/main/eschool/PhotoAlbum/Album/2012-10-9-dsngosdgndfk/
...
It is found that there is a pattern:
example.com/main/eschool/PhotoAlbum/Album/20*
, is it possible to download all those folders?
If you want to download everything under example.com/main/eschool/PhotoAlbum/Album/
, but not above it, you can use the --recursive
and --no-parent
options:
wget --no-parent --recursive http://example.com/main/eschool/PhotoAlbum/Album/
That will download everything below Album
directory. If you want to limit how deep wget
dives into the subdirectories, you can specify the --level
option:
wget --no-parent --recursive --level=3 http://example.com/main/eschool/PhotoAlbum/Album/
That will drill down up to 3 subdirectories below Album
.
However, neither of these methods filter by name – they will blindly download everything in a directory, and its subdirectories. If you want more control (e.g. to only download albums beginning with 20*
), you'll have to use a shell script, or a scripting language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With