【问题标题】:SHA1 checksum of files in large directory and output to text file大目录中文件的 SHA1 校验和并输出到文本文件
【发布时间】:2017-12-02 12:03:56
【问题描述】:

我需要通过文件将 sha1 校验和输出到输出文件中。如果这有所不同,并且整个目录包含约 28K 文件,则其中一些文件大于 8gb。

这是我需要的输出文件的样子:

SHA1(Windows printed document-1.pdf)= 1c1e2844be6e9ddd995941388b98c12a8b7a1e8d
SHA1(Windows printed document.pdf)= 4ea8a157c5d8d0fc9c38aa6312d120ab425900a0
SHA1(checklist.chk)= c5f9e078578925ef3de1e6075b0777d75296bb8f
...

这是目前为止的代码:

openssl dgst -sha1 * > ~/Desktop/output.txt

此代码适用于小文件或小型目录,但当我尝试将其投入生产时,它会引发参数列表太大的异常。

【问题讨论】:

标签: unix terminal openssl xargs


【解决方案1】:

试试hashdeep -c sha1 -r $DIRfind $DIR -print0 -type f | xargs -0 -I {} sha1sum {} > output.txt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-19
    • 1970-01-01
    • 2018-09-07
    • 2010-12-31
    • 1970-01-01
    • 1970-01-01
    • 2017-09-14
    • 2014-10-11
    相关资源
    最近更新 更多