I am trying to download all the image file in a folder. I tried
wget -r https://example.com/
These didn't work. Can anyone guide?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
If a target web server has directory indexing enabled, and all the files to download are located in the same directory, you can download all of them, by using wget's recursive retrieval option.
wget -r -l1 -A.jpg http://www.example.com/test/
it will download all
.jpg file from directory
if you don't want to download all file then the infos below will be helpful.
-A acclist --accept acclist -R rejlist --reject rejlist Specify comma-separated lists of file name suffixes or patterns to accept or reject. 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. --accept-regex urlregex --reject-regex urlregex Specify a regular expression to accept or reject the complete URL.
wget -r --no-parent -A '*.jpg' http://example.com/test/
wget -r --level=1 -A.jpg --ignore-length -x -np http://example.com/folder/
What does this do?
-r: Recursive retrieving (important)
--level=0: Specify recursion maximum depth level. 1 for just this directory.
-x: Force dirs, create an hierarchy of directories even if one would not been created otherwise
-np: no parent, do not ascend to parent dir when retrieving recursively
-A.type: only download files with the extension
My pronouns are He / Him