# Download all files from a url

**URL:** <https://forum.ansible.com/t/download-all-files-from-a-url/24059>\
**Category:** Ansible Project\
**Created:** [March 24, 2017, 5:08pm UTC](https://forum.ansible.com/t/download-all-files-from-a-url/24059 "2017-03-24T17:08:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [March 24, 2017, 5:08pm UTC](https://forum.ansible.com/t/download-all-files-from-a-url/24059/1 "2017-03-24T17:08:52Z")

</div>

win\_get\_url has options to download all files from an url with uid and pwd and save it locally? i tried with one file but it needs file extensions and exact file names for destination

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 25, 2017, 6:17am UTC](https://forum.ansible.com/t/download-all-files-from-a-url/24059/2 "2017-03-25T06:17:58Z")

</div>

I'm not sure what you mean by 'download all files from an url with uid  
and pwd', but it sounds like you're trying to mirror a website using  
some sort of pattern containing wildcards.  
If that is the case, win\_get\_url won't work as it only handles  
(explicitly named) single files.

You'd have to loop through a list of items - provided you know them beforehand.  
The concept of file extensions is irrelevant to HTTP so yes you need  
full filenames (i.e. including the extension).

If you don't know the filenames beforehand (the wildcard pattern  
scenario such as "[http://example.com/files/\*.txt&quot;\](http://example.com/files/*.txt&quot;%5C)), then you have to  
resort to tools like curl and wget.  
This in turn relies on the web server serving directory indexes etc.

Dick

---

<div class="post-metadata">

**Author:** ![groupfiles14](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@groupfiles14](https://forum.ansible.com/u/groupfiles14)\
**Post date:** [March 27, 2017, 8:36am UTC](https://forum.ansible.com/t/download-all-files-from-a-url/24059/3 "2017-03-27T08:36:49Z")

</div>

right now, i am downloading with exact link of the files and added those to with\_items…is there a way to check if the file is new or not…download only if it is new?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [March 27, 2017, 11:38am UTC](https://forum.ansible.com/t/download-all-files-from-a-url/24059/4 "2017-03-27T11:38:14Z")

</div>

Yes. Just use the ‘force: no’ parameter - see [http://docs.ansible.com/ansible/win\_get\_url\_module.html](http://docs.ansible.com/ansible/win_get_url_module.html)
