I would like to archive all files (to one .tar.gz file) in a directory when they are older than X days.
I have this one liner:
find /home/xml/ -maxdepth 1 -mtime +14 -type f -exec sh -c \ 'tar -czvPf /home/xml/archive/archive_$(date +%F).tar.gz $0' {} \;
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?
One more problem after @Alex answer: still many files are missing, check the screenshot.