# Fetch multiple files?

**URL:** <https://forum.ansible.com/t/fetch-multiple-files/13600>\
**Category:** Ansible Project\
**Created:** [October 3, 2013, 6:02am UTC](https://forum.ansible.com/t/fetch-multiple-files/13600 "2013-10-03T06:02:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaniv\_Kaul](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@Yaniv\_Kaul](https://forum.ansible.com/u/Yaniv_Kaul)\
**Post date:** [October 3, 2013, 6:02am UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/1 "2013-10-03T06:02:35Z")

</div>

Is there an existing feature request that fetch will be able to fetch multiple files (via a regular file pattern) ?  
Something like

fetch src=/tmp/results\* dest=/results/ flat=true

ansible-1.2.3-2.el6.noarch on CentOS 6.4

TIA,  
Y.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 7:30am UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/2 "2013-10-03T07:30:11Z")

</div>

No, this doesn’t exist per se.

I would also like to point out the latest released version of Ansible is 1.3.X, you can get this from epel-testing as it hasn’t hoped into mainstream EPEL just yet, but all testing is complete.

Fedora account holders may wish to +1 the package in the EPEL update system.

---

<div class="post-metadata">

**Author:** ![saurabh\_verma](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@saurabh\_verma](https://forum.ansible.com/u/saurabh_verma)\
**Post date:** [October 3, 2013, 9:06am UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/3 "2013-10-03T09:06:46Z")

</div>

So it means recursive copy is not easily possible ? or do we have module for recursive copy ?

~saurabh

---

<div class="post-metadata">

**Author:** ![Nick\_Maslov](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@Nick\_Maslov](https://forum.ansible.com/u/Nick_Maslov)\
**Post date:** [October 3, 2013, 10:11am UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/4 "2013-10-03T10:11:44Z")

</div>

You may use shell: rsync, I believe.

Regards,  
NM

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 12:22pm UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/5 "2013-10-03T12:22:33Z")

</div>

You can invoke rsync via a “local\_action”.

There’s no module for recursive copy. I’ll entertain support for it – it may be something we work on but there’s a long list of other priorities in front.

One of the main challenges of recursive copy is specifying the intermediate directory permissions and SELinux contexts along the way. The app would have to choose a behavior and most likely just figure out what you intended to do, which makes repeated behavior (idempotency) between runs a fun challenge.

It’s definitely doable, but rsync is almost always going to be more efficient.

Tim Appnel is working on a nice wrapper around rsync called “synchronize” to make your playbooks even easier to read and write, and that should be available in the development branch soon.

---

<div class="post-metadata">

**Author:** ![saurabh\_verma](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@saurabh\_verma](https://forum.ansible.com/u/saurabh_verma)\
**Post date:** [October 4, 2013, 2:20pm UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/6 "2013-10-04T14:20:17Z")

</div>

Awesome 🙂

---

<div class="post-metadata">

**Author:** ![Alex\_Rodenberg](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Alex\_Rodenberg](https://forum.ansible.com/u/Alex_Rodenberg)\
**Post date:** [October 4, 2013, 2:34pm UTC](https://forum.ansible.com/t/fetch-multiple-files/13600/7 "2013-10-04T14:34:29Z")

</div>

rsync wrapper! Sweet.
