2019-03-05 20:15:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-09-11 00:44:54 +00:00
|
|
|
#show2cp [md5 file] (relative path root)
|
|
|
|
|
2019-09-10 23:18:10 +00:00
|
|
|
md5="$1"
|
2019-09-11 00:44:54 +00:00
|
|
|
rootdir=""
|
|
|
|
[ -n "$2" ] && rootdir="$2/""
|
2019-09-10 23:18:10 +00:00
|
|
|
[ -z "$md5" ] && md5=2cp.md5
|
2019-09-04 14:19:20 +00:00
|
|
|
[ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; }
|
|
|
|
|
2019-03-05 20:15:49 +00:00
|
|
|
function calc_kb() {
|
|
|
|
i=0
|
2019-09-10 23:18:10 +00:00
|
|
|
cat "$1" | cut -c 34- | while read line; do
|
2019-09-11 00:44:54 +00:00
|
|
|
kb=$(du "${rootdir}${line}" | cut -f 1)
|
2019-03-05 20:15:49 +00:00
|
|
|
i=$((i+kb))
|
|
|
|
echo $i
|
|
|
|
done | tail -n1
|
|
|
|
}
|
|
|
|
|
2019-09-04 14:19:20 +00:00
|
|
|
kb=$(calc_kb "$md5")
|
2019-03-05 20:15:49 +00:00
|
|
|
mb=$((kb/1024))
|
|
|
|
gb=$((mb/1024))
|
|
|
|
tb=$((gb/1024))
|
|
|
|
|
|
|
|
echo "Noch Zu Kopieren: $kb Kb = $mb Mb = $gb Gb = $tb Tb"
|