wget工具:如何下载特定名称的文件
How to Download Only "FullList"-Containing .gz Files with wget
Hey there! You’ve already got a solid base command going—let’s adjust it to zero in on only the files that include "FullList" in their names.
The key tweak here is refining the -A (accept) parameter to use wildcard matching, which lets you target files with specific strings in their names. Here’s your updated command:
wget -r --no-parent -A "*FullList*.gz" --no-directories -R robots http://www.web.com/some_path/
Breakdown of the change:
-A "*FullList*.gz"replaces your original-A.gz. The*wildcards match any sequence of characters (including none), so this tells wget to only accept files that:- End with
.gz(like before) - Have "FullList" somewhere in their filename (before the
.gzsuffix)
- End with
All your other existing parameters stay intact:
-rkeeps recursive downloading to traverse subdirectories undersome_path/--no-parentprevents wget from climbing up to parent directories outside your target path--no-directoriesensures all downloaded files land in your current working directory (no nested folders created)-R robotsskips downloadingrobots.txtfiles (note: if you run into issues, you might need to use-R robots.txtexplicitly depending on your wget version)
Quick notes:
- Double-check the case of "FullList"—if the website uses uppercase/lowercase variations (like "fulllist" or "Fulllist"), adjust the string in the command to match exactly.
- The quotes around
"*FullList*.gz"are important to prevent your shell from interpreting the wildcards before wget gets them.
内容的提问来源于stack exchange,提问作者user9269628
相关产品推荐
相关产品推荐

