diff --git a/bin/swh-hashdir b/bin/swh-hashdir new file mode 100755 index 0000000..bb0f916 --- /dev/null +++ b/bin/swh-hashdir @@ -0,0 +1,20 @@ +#!/usr/bin/python3 + +# Copyright (C) 2015 The Software Heritage developers +# See the AUTHORS file at the top-level directory of this distribution +# License: GNU General Public License version 3, or any later version +# See top-level LICENSE file for more information + +import os +import sys + +from swh.core.hashutil import hashfile + +if __name__ == '__main__': + dirname = sys.argv[1] + + hashes = {} + for root, _dirs, files in os.walk(dirname): + for name in files: + path = os.path.join(root, name) + hashes[path] = hashfile(path)