title: Ansible : delete all files and directories inside a folder and not the folder itself
body: <p>i'm trying to run a task which deletes all the content of my project fiolder , without deleting the folder itself:</p>
  
  <p><strong>my folder</strong> : appFolder <strong>----contains----></strong> file1 , file2 ... fileN , directory1 ...directoryN</p>
  
  <p>i ve tried to use <strong>ls</strong> , <strong>fileGlob</strong> , but that didn't work properly.</p>
  
  <pre><code>- name: delete old version files
    file:
     path: "{{ paths }}"
     state: absent
    with_filesglob:
     - "{{paths}}deletes/*"
  </code></pre>
  
  <p>also with shell module (not good because it didn't delete file with special characters names)</p>
  
  <pre><code>- shell: ls -1 /some/dir
    register: contents
  
  - file: path=/some/dir/{{ item }} state=absent
    with_items: {{ contents.stdout_lines }}
  </code></pre>
  
  <p><strong>A better solution ?</strong></p>