Using wget to recursively fetch a directory with arbitrary files in it

前端 未结 14 2061
再見小時候
再見小時候 2020-11-27 08:31

I have a web directory where I store some config files. I\'d like to use wget to pull those files down and maintain their current structure. For instance, the remote directo

14条回答
  •  情歌与酒
    2020-11-27 09:08

    You have to pass the -np/--no-parent option to wget (in addition to -r/--recursive, of course), otherwise it will follow the link in the directory index on my site to the parent directory. So the command would look like this:

    wget --recursive --no-parent http://example.com/configs/.vim/
    

    To avoid downloading the auto-generated index.html files, use the -R/--reject option:

    wget -r -np -R "index.html*" http://example.com/configs/.vim/
    

提交回复
热议问题