Download files with acclist not working as excpected

Viewed 114

I want to download all files matching a certain pattern from https://download.osmand.net/list.php.

For example running

wget -nd -r -A 'list.php, *Sweden_*' https://download.osmand.net/list.php

downloads only list.php.

If I use

wget -nd -r -A 'list.php, *' https://download.osmand.net/list.php

instead all files are downloaded.

What is wrong with my acclist in the first example?

1 Answers

I didn't know myself, researching for this answer I learned something new.

wget docs says:

‘-A acclist --accept acclist’
‘-R rejlist --reject rejlist’
Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it, like in ‘-A ".mp3"’ or ‘-A '*.mp3'’.

‘--accept-regex urlregex’
‘--reject-regex urlregex’
Specify a regular expression to accept or reject the complete URL.

So it seems that -A can be used to check extensions, but not the full pattern of the link. To search the full pattern, you need the --accept-regex urlregex option.

The following command worked for me.

wget -nd -r --accept-regex 'Sweden_' https://download.osmand.net/list.php
Related