# How to find files added or changed since installation



## balanga (Feb 24, 2018)

I'm trying to backup all the files that were added or changed since FreeBSD was installed. Should I be able to do that simply using the find(1) command ? I'm assuming that all the files that are part of the base installation have the same datestamp.


----------



## Beastie (Feb 24, 2018)

Something like that should do:
`touch -d "2017-01-01 00:00:00" /tmp/timestamp`
`find / -type f -newer /tmp/timestamp`


----------



## balanga (Feb 24, 2018)

Excellent!

Now all I need to do is somehow pipe the resultant filelist into tar....


----------



## balanga (Feb 24, 2018)

I guess something like this will do:-

`find . -type f | xargs tar -czvf backup.tar.gz`


----------



## phoenix (Feb 25, 2018)

mtree(8) is the tool you are looking for. You've described basically the whole reason for its existence (fighting files that have changed, been added, or removed).

You run it once to generate a listing of hashes for all files. Then, everytime it's run after that, the gates are compared to find the differences.

It's used by the installation and upgrade tools in FreeBSD. There are hash databases somewhere in /var, I believe.


----------

