# copy multiple files

**URL:** <https://forum.ansible.com/t/copy-multiple-files/12208>\
**Category:** Ansible Project\
**Created:** [January 17, 2013, 4:12pm UTC](https://forum.ansible.com/t/copy-multiple-files/12208 "2013-01-17T16:12:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandm3](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dandm3](https://forum.ansible.com/u/dandm3)\
**Post date:** [January 17, 2013, 4:12pm UTC](https://forum.ansible.com/t/copy-multiple-files/12208/1 "2013-01-17T16:12:23Z")

</div>

Is there a way to copy multiple files with a single command? The copy module doesn’t seem to handle “\*.conf” for example. I often want to deploy an entire folder containing multiple files and it would be tedious to have to specify each file individually. Is there a way to do this? (I know there is the git module, but in many cases that would be over-kill.)

Dan

---

<div class="post-metadata">

**Author:** ![Yves\_Dorfsman](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@Yves\_Dorfsman](https://forum.ansible.com/u/Yves_Dorfsman)\
**Post date:** [January 17, 2013, 4:27pm UTC](https://forum.ansible.com/t/copy-multiple-files/12208/2 "2013-01-17T16:27:27Z")

</div>

I have use rsync with a local\_action for something similar, but yes a "copy directory" or even an rsync module would be nice.

&nbsp;&nbsp;&nbsp;tasks:

&nbsp;&nbsp;&nbsp;- name: install prereqs for ansible  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;action: apt pkg=$item  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- python-yaml  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- python-paramiko  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- python-jinja2

&nbsp;&nbsp;&nbsp;- name: create /export directory  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;action: command mkdir -p /export/ansible creates=/export/ansible

&nbsp;&nbsp;&nbsp;- name: rsync (push) ansible  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local\_action: command rsync --delete -uaSHAXEx /export/ansible/ansible $inventory\_hostname:/export/ansible

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 17, 2013, 5:35pm UTC](https://forum.ansible.com/t/copy-multiple-files/12208/3 "2013-01-17T17:35:53Z")

</div>

There's an outstanding pull request for making copy recursive if the  
source is a directory.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 18, 2013, 1:03pm UTC](https://forum.ansible.com/t/copy-multiple-files/12208/4 "2013-01-18T13:03:55Z")

</div>

You can use with\_fileglob to have copy module iterate over the \*.conf

Brian Coca

---

<div class="post-metadata">

**Author:** ![James\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@James\_Nguyen](https://forum.ansible.com/u/James_Nguyen)\
**Post date:** [January 25, 2013, 2:54am UTC](https://forum.ansible.com/t/copy-multiple-files/12208/5 "2013-01-25T02:54:12Z")

</div>

Just to be clear, that pull request will follow folders as well if it’s in the source directory?
