From d6330f53823c36741a1cb8abd41d68fe9f9c5c28 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 11 Sep 2019 01:18:10 +0200 Subject: [PATCH] rename data fiels --- 2cp => 2cp.md5 | 0 2rm => 2rm.md5 | 0 cp_sh | 2 +- select | 14 +++++++------- show2cp | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) rename 2cp => 2cp.md5 (100%) rename 2rm => 2rm.md5 (100%) diff --git a/2cp b/2cp.md5 similarity index 100% rename from 2cp rename to 2cp.md5 diff --git a/2rm b/2rm.md5 similarity index 100% rename from 2rm rename to 2rm.md5 diff --git a/cp_sh b/cp_sh index 5f17d48..b7304d9 100755 --- a/cp_sh +++ b/cp_sh @@ -7,7 +7,7 @@ function free_disk() { df "$1" | tail -n1 | sed -r -e "s/[\t\ ]+/ /g" | cut -d ' ' -f 4 } -md5="2cp" +md5="2cp.md5" aim="/mnt/export/transport" diff --git a/select b/select index ff730ed..29b89ad 100755 --- a/select +++ b/select @@ -1,10 +1,10 @@ #!/bin/bash #wenn delete file exits -> handle deletons (importand for konflict handling -[ -f 2rm ] && { - cat 2rm | cut -c -32 | while read line; do +[ -f 2rm.md5 ] && { + cat 2rm.md5 | cut -c -32 | while read line; do sed -i "/$line/d" vorhanden done - cat 2rm | cut -c 35- | while read line; do + cat 2rm.md5 | cut -c 35- | while read line; do l=$(grep " $line"$ vorhanden) [ -n "$l" ] && { echo $l @@ -12,20 +12,20 @@ sed -i "/$md5/d" vorhanden } done - rm 2rm + rm 2rm.md5 } #gleiche dateien anhand md5 aussortieren -cat vorhanden | cut -c -32 | while read line; do sed -i "/$line/d" 2cp ; done +cat vorhanden | cut -c -32 | while read line; do sed -i "/$line/d" 2cp.md5 ; done #dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln echo Konflicts: echo cat vorhanden | cut -c 35- | while read line; do - l=$(grep " $line"$ 2cp | tee -a konflicts) + l=$(grep " $line"$ 2cp.md5 | tee -a konflicts) [ -n "$l" ] && { echo $l md5=$(echo $l | cut -c -32) - sed -i "/$md5/d" 2cp + sed -i "/$md5/d" 2cp.md5 } done diff --git a/show2cp b/show2cp index b80b86a..868ba09 100755 --- a/show2cp +++ b/show2cp @@ -1,12 +1,12 @@ #!/bin/bash -md5=$1 -[ -z "$md5" ] && md5=2cp +md5="$1" +[ -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 + cat "$1" | cut -c 34- | while read line; do kb=$(du "$line" | cut -f 1) i=$((i+kb)) echo $i