Backup apps on Linux after a certain date

Posted on

Problem :

Is there a way to back up applications installed after a certain point in time?

Example: I would like to back up all the applications that have been installed within the last month. Is this possible? It’s okay if it’s not an entire application and just an upgrade too that counted as an installation.

Solution :

This command

find /start/directory -type f -atime +n -print

will find and write to stdout all files accessed more than n days ago. If you wish to find those that were modified more than n days ago, use mtime instead of atime.

You can now modify this command to provide a backup, like

find /start/directory -type f -atime +n -exec cp {} /backup/dir ;

or simply you can output all file names to a file

find /start/dir -type f -atime +n -print > file_list.txt

and then act on this list as you see fit.

Leave a Reply

Your email address will not be published. Required fields are marked *