title: Getting the newest filename in a directory in Ansible
body: <p>I have an Ansible script, and I am trying to get the filename of the newest item in a directory.  I am using this Ansible script:</p>
  
  <pre><code>- name: Finding newest file in a folder
    find:
      paths: "/var/www/html/wwwroot/somefolder/"
      age: "latest"
      age_stamp: mtime
  </code></pre>
  
  <p>However, I am getting the following error - </p>
  
  <pre><code>FAILED! =&gt; {"age": "latest", "changed": false, "failed": true, "msg": "failed to process age"}
  </code></pre>
  
  <p>How can I get Ansible to retrieve the filename of the newest file in a directory?</p>