计算目录的校验和
我需要计算相关目录的校验和。
它应该为该目录返回一个数字,而不是为其中的每个文件返回一个数字。
奎斯,你能帮我吗?
谢谢。
i need to calculate a checksum for a directory in question.
It should return one number for this directory, not for each file inside it.
Can you, quys, help me with it ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
tar
来执行此操作。类似 tar -c dir/ | 之类的东西md5sum -b,尽管您可能需要使用tar
选项,因此它不包括访问时间(如果有人访问该目录中的文件,这会弄乱校验和,即使不修改其中任何一个)。You may be able to use
tar
to do this. Something liketar -c dir/ | md5sum -b
, although you may need to play with the options totar
so it doesn't include access times (which would mess up the checksum if somebody accesses the files in that directory, even without modifying any of them).查看 md5deep。从其主页:
我自己没有使用过它,但据我所知,它几乎是来自 GNU Coreutils。
Check out md5deep. From its homepage:
I haven't used it myself, but from what I gather it's pretty much a collection of multi-file versions of md5sum, sha256sum and similar checksum tools from GNU Coreutils.