# How to Ansible copy force overwrite

**URL:** <https://forum.ansible.com/t/how-to-ansible-copy-force-overwrite/36349>\
**Category:** Ansible Project\
**Created:** [February 21, 2022, 2:27pm UTC](https://forum.ansible.com/t/how-to-ansible-copy-force-overwrite/36349 "2022-02-21T14:27:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kerem\_Kalayci](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kerem\_Kalayci](https://forum.ansible.com/u/Kerem_Kalayci)\
**Post date:** [February 21, 2022, 2:27pm UTC](https://forum.ansible.com/t/how-to-ansible-copy-force-overwrite/36349/1 "2022-02-21T14:27:33Z")

</div>

Hi everyone,

i m trying to copy file. But win\_copy doesn’t copy overwrite. How can I overcome this error? is there a way to get around this?

my code\>\>\>

- name: Copy a single file where the source is on the remote host  
win\_copy:  
src: C:\Tools\AWXtest\New folder\autounattend.xml  
dest: E:\OtomasyonFiles\WINDOWSISO\win2019  
remote\_src: yes

> > > >

Error: “msg”: "cannot copy file from ‘C:\Tools\AWXtest\New folder\autounattend.xml’ to ‘E:\OtomasyonFiles\WINDOWSISO\win2019’: dest is already a folder

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [February 21, 2022, 3:17pm UTC](https://forum.ansible.com/t/how-to-ansible-copy-force-overwrite/36349/2 "2022-02-21T15:17:24Z")

</div>

[https://docs.ansible.com/ansible/latest/collections/ansible/windows/win\_copy\_module.html#parameter-force](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_copy_module.html#parameter-force)

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [February 22, 2022, 12:23am UTC](https://forum.ansible.com/t/how-to-ansible-copy-force-overwrite/36349/3 "2022-02-22T00:23:33Z")

</div>

The problem here is you are telling it to copy the file to the location E:\OtomasyonFiles\WINDOWSISO\win2019 which is a folder. Add a trailing \ to the dest or use the full path to where you want the file to be (‘E:\OtomasyonFiles\WINDOWSISO\win2019\autounattend.xml’) so it knows to place the file in the folder rather than the folder itself.
