• Register

Is checking fixity at the folder level sufficient for knowing if any files within that folder that been altered?

+1 vote
267 views
asked Feb 7, 2018 by cathymiller85 (130 points)

1 Answer

+1 vote

Yes, depending on the method used for computing the checksums and what types of changes you are trying to identify.  One solution is to create a tempory archive of the folder and compute the checksum on that file.  The following command, using standard GNU/Linux tools will compute a checksum and can be used to identify any change to the files' content, name, persmission, and/or directory structure.

$ tar -cf - somedir | md5sum

This uses the tar command to create a single archive file for the folder and its contents.  The c option creates the archive, the f option specifies a file to save the archive to, the - sets the saved-to file as stdout (temporary), the | character directs the created archive to the next command, md5sum, which computes the checksum.

 

One caveat, this will not indicate which specific files changed (for that a tool like md5deep can be used).  Source and additional options/discussion:  https://unix.stackexchange.com/questions/35832/how-do-i-get-the-md5-sum-of-a-directorys-contents-as-one-sum

 

answered Sep 12, 2019 by decirella (270 points)
...