That link looks great. I'll try it once I have access to my system.
With regards to the second part, what I meant is being able to generate a unique identifier based on a directory and all of it's contents. I've found this so I think I'll be able to do what I'm looking for with an MD5 hash via the md5sum command. My motivation for this is that I can then compare the hashes for the two directories to check if there are any differences. It won't tell me what those differences are though and that's what the first part is for.
Yeah, I got what you meant, but I just wasn't too sure how it could be done. Your link appears to provide a means of getting a set of md5 hashes for all the files in the directory, but not a single hash for the directory as a whole.
But it gives me an idea. Why not pipe the output of the "tree" command into md5sum; that way you get a hash of the directory listing. That's going to change is any of the directory contents change, but not if the contents of any of the files do. If I understand correctly, that's what you want.
If you actually want to watch the contents of the files as well, you could pipe the output of the comand that you linked to through md5sum. That would change for any change in the directory structure or the contents of any of the files.