Wget
Как выкачать файл с помощью Wget
wget -m -p -E -k -np www.example.com
-m, –mirror | Включить рекурсию и метку времени, устанавливает бесконечную глубину рекурсии и сохраняет листинги каталогов FTP. |
-p, –page-requisites | Получите все изображения и т.д., необходимые для отображения HTML-страницы |
-E, –adjust-extension | Сохраняйте HTML/CSS-файлы с расширениями .html/.css |
-k, –convert-links | Сделайте так, чтобы ссылки в загружаемом HTML указывали на локальные файлыv |
-np, –no-parent | Не поднимайтесь к родительскому каталогу при рекурсивном поиске. Это гарантирует, что будут загружены только файлы ниже определенной иерархии. Требуется косая черта в конце каталога, например example.com/foo/. |
Recursive accept/reject:
- A, –accept=LIST comma-separated list of accepted extensions.
- R, –reject=LIST comma-separated list of rejected extensions.
- -accept-regex=REGEX regex matching accepted URLs.
- -reject-regex=REGEX regex matching rejected URLs.
- -regex-type=TYPE regex type (posix|pcre).
- D, –domains=LIST comma-separated list of accepted domains.
- -exclude-domains=LIST comma-separated list of rejected domains.
- -follow-ftp follow FTP links from HTML documents.
- -follow-tags=LIST comma-separated list of followed HTML tags.
- -ignore-tags=LIST comma-separated list of ignored HTML tags.
- H, –span-hosts go to foreign hosts when recursive.
- L, –relative follow relative links only.
- I, –include-directories=LIST list of allowed directories.
- -trust-server-names use the name specified by the redirection
url last component.
- X, –exclude-directories=LIST list of excluded directories.
- np, –no-parent don't ascend to the parent directory.
so you can use -R or –reject to reject extentions this way:
wget -R="index.html,*.tiff,*.pdf,*.jpg" http://example.com/ and in my case here is final command which I wanted to recursively download/update none-html files from an indexed website directory:
wget -N -r -np -nH –cut-dirs=3 -nv -R="*.htm*,*.html" http://example.com/1/2/3/