3 ms·
Incidentally, given the directory structure above, here's a good way to calculate sha256 checksums over the files. It shells out rather than use the IRONCLAD p
by zeveb 10y ago
Incidentally, given the directory structure above, here's a good way to calculate sha256 checksums over the files. It shells out rather than use the IRONCLAD package to calculate the checksums.
(let ((src #P"/tmp/foo/bar/")
(dst #P"/tmp/foo/baz/"))
(flet ((sha256sum (path)
"Return the SHA256 checksum of PATH as a string (which is
good enough for our purposes here)."
(first (split-sequence:split-sequence
#\Space
(uiop:run-program `("sha256sum" ,(namestring path))
:output :string)))))
(loop for src-path in (directory (uiop:merge-pathnames* "**/*.*" src))
for dst-path = (uiop:merge-pathnames* (uiop:subpathp src-path src) dst)
for file = (uiop:truename* dst-path)
if file
when (uiop:file-pathname-p file)
do (unless (string= (sha256sum src-path) (sha256sum dst-path))
(warn "~a does not match ~a" dst-path src-path))
end
else
do (warn "~a not found" dst-path))))