``cdb filterpath``::
find ${DIR} -type f -print0 | \
- cdb --db ${DB} filterpath --inul --format '$u$z' --nul > ${DB}.new-files0
+ cdb filterpath -1 -P -p out -0 -f '$u$z' > ${DB}.new-files0
.. _xargs_sha:
This database may not seem very useful, but when combined with ``cdb --db diff`` we
can quickly find all paths whose checksums are unknown to the database::
- cdb --db ${DB} diff ${JPDB} --flavor=path --which=super --format '$u$z' --nul > ${DB}.new-files0
+ cdb diff ${JPDB} --no-headers --flavor=path --which=super --format '$u$z' -0 > ${DB}.new-files0
And then proceed as `above <xargs_sha>`_.
database to prune tracked paths not in the "just paths" database if the hashes
are observed elsewhere::
- cdb --db ${DB} diff ${JPDB} --flavor=path --which=sub --no-headers --format '$u$z' --nul > ${JPDB}.missing-files0
- cdb --db ${DB} domv --inul < ${JPDB}.missing-files0
- cdb --db ${DB} gc > ${DB}.gc
+ cdb diff ${JPDB} --flavor=path --which=sub --no-headers --format '$u$z' --nul > ${JPDB}.missing-files0
+ cdb domv --inul < ${JPDB}.missing-files0
+ cdb gc > ${DB}.gc
sqlite3 ${DB} < ${DB}.gc
.. TODO or if the observed digest is now superseded?
above::
find ${DIR} -type f -print0 | \
- cdb --db ${DB} filterpath --in-path --predicate=out -0 -1 --format '$u$z' | \
+ cdb filterpath --in-path --predicate=out -0 -1 --format '$u$z' | \
xargs -0 sha512sum > ${DB}.new
We can then prepare to prune duplicates and add unique files::
local args = argp:parse()
-- io.stderr:write((require "pl.pretty").write(args), "\n")
-if not args.database then argp:error("Database is required") end
+if not args.database then
+ argp:error("Database is required; pass --db or set CDB env var")
+end
local dbh, err = dbi.Connect("SQLite3", args.database)
if not dbh then