37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
# arrange
|
|||
|
|
|
||
|
|
de-duplicate and arrange photos and movies into a content-addressed store,
|
||
|
|
with hardlinks by date.
|
||
|
|
|
||
|
|
out/content/ab/cdef….jpg one copy of each file, named by its sha256
|
||
|
|
out/date/2006/03/1143508767….jpg hardlinks to those, by capture time
|
||
|
|
|
||
|
|
Capture time comes from exif (jpeg, heic, camera raw), the QuickTime movie
|
||
|
|
header (mov, mp4, m4v, 3gp), or the file's mtime as a last resort.
|
||
|
|
|
||
|
|
## usage
|
||
|
|
|
||
|
|
go install mcquay.me/arrange/cmd/am@latest
|
||
|
|
|
||
|
|
# see what would happen; prints new/dup<TAB>src<TAB>content<TAB>date dir
|
||
|
|
am arr -n ~/Pictures /mnt/store > plan.tsv
|
||
|
|
|
||
|
|
# do it; nothing in the source is changed
|
||
|
|
am arr ~/Pictures /mnt/store
|
||
|
|
|
||
|
|
# re-hash the store: corrupt files, orphans, leftovers from crashed runs
|
||
|
|
am verify /mnt/store
|
||
|
|
|
||
|
|
# turn dated files that are copies rather than hardlinks back into links
|
||
|
|
am clean -n /mnt/store
|
||
|
|
am clean /mnt/store
|
||
|
|
|
||
|
|
# print the time and path am would use for some files
|
||
|
|
am meta a.jpg b.mov
|
||
|
|
|
||
|
|
`arr` ends with a summary of counts and sizes by extension and year. It
|
||
|
|
names no files, so it is safe to share.
|
||
|
|
|
||
|
|
Stores made before sha256 use md5 names; add to one with `-hash=md5`.
|
||
|
|
`verify` works out the hash from each name's length.
|