如何在wget中使用正则表达式拒绝文件?
问题描述:
我正在尝试使用wget工具下载网站内容.我使用-R选项拒绝某些文件类型.但还有其他一些我不想下载的文件.这些文件的命名如下,没有任何扩展名.
I am trying to download the contents of a website using wget tool. I used -R option to reject some file types. but there are some other files which I don't want to download. These files are named as follows, and don't have any extensions.
string-ID
例如:
newsbrief-02
我如何告诉wget不要下载这些文件(文件名以指定字符串开头的文件)?
How I can tell wget not to download these files (the files which their names start with specified string)?
答
您不能在 wget -R
键中指定正则表达式,但是可以指定模板(例如外壳).
You can not specify a regular expression in the wget -R
key, but you can specify a template (like file template in a shell).
答案如下:
$ wget -R 'newsbrief-*' ...
您还可以使用?
和符号类 []
.
You can also use ?
and symbol classes []
.
有关更多信息,请参见信息wget