# \[STAT\] Execute script if it's exist

**URL:** <https://forum.ansible.com/t/stat-execute-script-if-its-exist/29322>\
**Category:** Ansible Project\
**Created:** [December 24, 2018, 1:46pm UTC](https://forum.ansible.com/t/stat-execute-script-if-its-exist/29322 "2018-12-24T13:46:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcoussi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mcoussi/32/8056_2.png) [@mcoussi](https://forum.ansible.com/u/mcoussi)\
**Post date:** [December 24, 2018, 1:46pm UTC](https://forum.ansible.com/t/stat-execute-script-if-its-exist/29322/1 "2018-12-24T13:46:44Z")

</div>

Hi,

I want to execute a command if a file exist.

The script juste create a file in the same folder.  
`  
#/bin/sh

touch test.txt  
`

Ansible execute module below.  
`

---

<div class="post-metadata">

**Author:** ![mcoussi](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mcoussi/32/8056_2.png) [@mcoussi](https://forum.ansible.com/u/mcoussi)\
**Post date:** [December 24, 2018, 2:13pm UTC](https://forum.ansible.com/t/stat-execute-script-if-its-exist/29322/2 "2018-12-24T14:13:10Z")

</div>

In fact, the file is created in /rppt.

It’s ok 🙂

Matt
