Reputation: 128
Given a path, I want to record the folder’s unique characteristics, so that next time I check these characteristics, I can tell if the folder has been changed or not.
The solution I can think of is to recursively record all the files’ path and checksum in string, and then calculate the checksum of the string.
I wonder if there’s more efficient way to do this.
Upvotes: 0
Views: 256
Reputation: 360
You could save some calculations by looking at the mtime of the files inside the folder instead of calculating their hash.
You'd still need to do it for all the files inside the folder, as altering a file does not update the mtime of the folder containing it.
Upvotes: 1