work with relative paths
This commit is contained in:
parent
84c8342ac7
commit
67aac118b9
6
show2cp
6
show2cp
@ -1,13 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#show2cp [md5 file] (relative path root)
|
||||||
|
|
||||||
md5="$1"
|
md5="$1"
|
||||||
|
rootdir=""
|
||||||
|
[ -n "$2" ] && rootdir="$2/""
|
||||||
[ -z "$md5" ] && md5=2cp.md5
|
[ -z "$md5" ] && md5=2cp.md5
|
||||||
[ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; }
|
[ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; }
|
||||||
|
|
||||||
function calc_kb() {
|
function calc_kb() {
|
||||||
i=0
|
i=0
|
||||||
cat "$1" | cut -c 34- | while read line; do
|
cat "$1" | cut -c 34- | while read line; do
|
||||||
kb=$(du "$line" | cut -f 1)
|
kb=$(du "${rootdir}${line}" | cut -f 1)
|
||||||
i=$((i+kb))
|
i=$((i+kb))
|
||||||
echo $i
|
echo $i
|
||||||
done | tail -n1
|
done | tail -n1
|
||||||
|
Loading…
Reference in New Issue
Block a user