# copy without need to specify parent directory

**URL:** <https://forum.ansible.com/t/copy-without-need-to-specify-parent-directory/13141>\
**Category:** Ansible Project\
**Created:** [July 17, 2013, 3:38pm UTC](https://forum.ansible.com/t/copy-without-need-to-specify-parent-directory/13141 "2013-07-17T15:38:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![celine](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@celine](https://forum.ansible.com/u/celine)\
**Post date:** [July 17, 2013, 3:38pm UTC](https://forum.ansible.com/t/copy-without-need-to-specify-parent-directory/13141/1 "2013-07-17T15:38:35Z")

</div>

“copy” action allows us to copy but the parent directory has to be present on server to succesfully execute action. Same for rsync.

Is there a way to copy file from client to server even when parent directory has not yet been created?

so far i have to run:  
shell: mkdir -p /path

then run:  
action: copy or local\_action: rsync

Is there any way to eliminate first step mkdir?

---

<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:** [July 17, 2013, 4:43pm UTC](https://forum.ansible.com/t/copy-without-need-to-specify-parent-directory/13141/2 "2013-07-17T16:43:13Z")

</div>

We generally like the destination directory to have to exist (i.e. be specified with the file module, no need for the mkdir call) so you have the opportunity to consider ownership.

–Michael
