blob: 099bce7d82c88c42dfb29fd51eb39a7e7cdc31e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/local/plan9/bin/rc
fn sum {
find . -type f | while (file = `{read}) {
if (test -f $"file ) {
sha256 $"file
}
}
}
previous = ''
sum | sed -E -e 's/(.*) = (.*)/\2 \1/' -e 's/SHA256 .//' -e 's/.$//' | sort | \
tee sum | while (line = `{read}) {
#cat sum | while (line = `{read}) {
sum = `{echo $line | sed -E -e 's/([^ ]*) (.*)/\1/'}
file = `{echo $line | sed -E -e 's/([^ ]*) (.*)/\2/'}
if (~ $sum $previous) {
echo $"file is a duplicate.
}
previous = $sum
}
|