From 74217e16bf0920f4519bdd4af908eac0b0baa2e2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 4 Sep 2019 15:38:47 +0200 Subject: [PATCH] todo marker + log is path independend --- cp_sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cp_sh b/cp_sh index 76226ad..d316338 100755 --- a/cp_sh +++ b/cp_sh @@ -19,8 +19,8 @@ cat "$md5_tmp" | while read line; do file_orig="$(echo $line | cut -c 33- | sed -r -e "s/^[\ ]//g")" file_size=$(du "$file_orig" | cut -f 1) file_md5=$(echo $line | cut -c -32) - file_aim_dir=$(echo $file_orig | rev | cut -d '/' -f 2- | rev | sed 's/data\/Filme/mnt\/export\/transport/g') - file_aim=$(echo $file_orig | sed 's/data\/Filme/mnt\/export\/transport/g') + file_aim_dir=$(echo $file_orig | rev | cut -d '/' -f 2- | rev | sed 's/data\/Filme/mnt\/export\/transport/g') #prepare destination - not automated jet + file_aim=$(echo $file_orig | sed 's/data\/Filme/mnt\/export\/transport/g') #prepare destination - not automated jet [ "$file_orig" == "$file_aim" ] && { echo Script ERROR; exit 255; } @@ -38,19 +38,19 @@ cat "$md5_tmp" | while read line; do file_md5_new=$(cat "$file_orig" | tee "$file_aim" | md5sum | cut -c -32) if [ "${file_md5_new}" == "${file_md5}" ]; then - echo "$file_md5 $file_aim" >> /mnt/export/md5.txt + echo "$file_md5 $file_aim" >> "${md5}.sucess-log" sed -i "/$file_md5/d" "$md5" else - echo "Error: Hash mismatch: \"NEW:${file_md5_new} OLD:${file_md5}\" $file_aim" + echo "Error: Hash mismatch: \"NEW:${file_md5_new} OLD:${file_md5}\" $file_aim" | tee "${md5}.error-log" sed -i "/$file_md5/d" "$md5" fi else - echo "To Big: $file_md5 $file_orig" + echo "To Big: $file_md5 $file_orig" | tee "${md5}.error-log" fi else - echo "Error: Not Exist: $file_orig" + echo "Error: Not Exist: $file_orig" | tee "${md5}.error-log" sed -i "/$file_md5/d" "$md5" fi done