# Copying file with roles using file glob

**URL:** <https://forum.ansible.com/t/copying-file-with-roles-using-file-glob/16450>\
**Category:** Ansible Project\
**Created:** [October 7, 2014, 7:33am UTC](https://forum.ansible.com/t/copying-file-with-roles-using-file-glob/16450 "2014-10-07T07:33:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gerhard\_Hannemann](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@Gerhard\_Hannemann](https://forum.ansible.com/u/Gerhard_Hannemann)\
**Post date:** [October 7, 2014, 7:33am UTC](https://forum.ansible.com/t/copying-file-with-roles-using-file-glob/16450/1 "2014-10-07T07:33:06Z")

</div>

Hi

Stumbling across a problem with copying a set of file to a remote server.  
I have a set of files within a particular role, under the file directory, that a I need to copy across to a set of remote server.  
I gave up on synchronization as it only produce a connection refused error.  
Trying copy in a loop using with file\_glob. I read the documentation regarding fileglobs in a role  
Questions:  
Is there any way for stripping the leading path?  
Is my only option to copy these file using a local shell command, possibly using rysnc?  
Are the any other suggestions on how this can be neatly done?

Thanks

Regards  
Gerhard

---

<div class="post-metadata">

**Author:** ![Gerhard\_Hannemann](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@Gerhard\_Hannemann](https://forum.ansible.com/u/Gerhard_Hannemann)\
**Post date:** [October 17, 2014, 7:10am UTC](https://forum.ansible.com/t/copying-file-with-roles-using-file-glob/16450/2 "2014-10-17T07:10:00Z")

</div>

Solved myself

I used the following filter to achieve what I need:

{{ item | basename }}

Regards  
Gerhard
