title: Archive files older than x days
body: <p>I would like to archive all files (to one .tar.gz file) in a directory when they are older than X days.</p>
  
  <p>I have this one liner:</p>
  
  <pre><code>find /home/xml/ -maxdepth 1 -mtime +14 -type f -exec sh -c \ 'tar -czvPf /home/xml/archive/archive_$(date +%F).tar.gz $0' {} \;
  </code></pre>
  
  <p>When I run this command, I see correct files selected in this directory, but in the archive is only the last file. Is there any way to get all files into one tar.gz archive?</p>
  
  <p>One more problem after @Alex answer: still many files are missing, check the screenshot.</p>
  
  <p><a href="https://i.stack.imgur.com/HdTrt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HdTrt.png" alt="enter image description here"></a>
  Maybe the colons (:) are causing the problem?</p>