From 67aac118b9601caca3315f8e37dea2a01d145340 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 11 Sep 2019 02:44:54 +0200 Subject: [PATCH] work with relative paths --- show2cp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/show2cp b/show2cp index 868ba09..ee5d5b0 100755 --- a/show2cp +++ b/show2cp @@ -1,13 +1,17 @@ #!/bin/bash +#show2cp [md5 file] (relative path root) + md5="$1" +rootdir="" +[ -n "$2" ] && rootdir="$2/"" [ -z "$md5" ] && md5=2cp.md5 [ -f "$md5" ] || { echo "ERROR: $md5 not found"; exit 255; } function calc_kb() { i=0 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)) echo $i done | tail -n1