# copy module wildcards

**URL:** <https://forum.ansible.com/t/copy-module-wildcards/22483>\
**Category:** Ansible Project\
**Created:** [September 5, 2016, 8:45am UTC](https://forum.ansible.com/t/copy-module-wildcards/22483 "2016-09-05T08:45:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alix\_Ak](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@Alix\_Ak](https://forum.ansible.com/u/Alix_Ak)\
**Post date:** [September 5, 2016, 8:45am UTC](https://forum.ansible.com/t/copy-module-wildcards/22483/1 "2016-09-05T08:45:25Z")

</div>

Example :

- name: copying only .conf files  
copy: src={{ item.0 }} dest={{ item.1 }}  
with\_together:
- [‘/file1/foo/_.conf’, /file1/foo/_.txt’]
- [‘/etc/boo/’, ‘/etc/goo’]

I have a folder with a lot of conf files or other file extension and i need to copy them to different folders on the server.  
In Ansible’s docs there only the hint using wildcards in host file. Apparently this doesn’t work in copy module.  
Is there any way to use wildcard or regex in this module rather than having to right a module for each file ?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [September 5, 2016, 12:29pm UTC](https://forum.ansible.com/t/copy-module-wildcards/22483/2 "2016-09-05T12:29:50Z")

</div>

To use copy with wildcard, check out with\_fileglob  
[http://docs.ansible.com/ansible/playbooks\_loops.html#id4](http://docs.ansible.com/ansible/playbooks_loops.html#id4)
