From a85d67dab5af54a52325752c8204bc095ec38b97 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 7 Aug 2022 23:14:19 +0300 Subject: [PATCH] replaced 7z to zip --- utils/statuses2files.sh | 2 +- utils/statuses_archiver.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/statuses2files.sh b/utils/statuses2files.sh index 8cbdebd..db844b2 100755 --- a/utils/statuses2files.sh +++ b/utils/statuses2files.sh @@ -12,7 +12,7 @@ for i in $ids; do if [ -f "$main_basedir"/all_statuses/$instance/$i/$i.json ]; then ids=$(echo "$ids" | sed -E "s/.?$i.?//g") continue - elif [ -n "$(7z e -so $main_basedir/archives/$instance.7z $i | cat)" ]; then + elif [ -n "$(unzip -p $main_basedir/archives/$instance.zip "**/$i.json")" ]; then ids=$(echo "$ids" | sed -E "s/.?$i.?//g") continue elif [ -d "$main_basedir"/all_statuses/$instance/$i ]; then diff --git a/utils/statuses_archiver.sh b/utils/statuses_archiver.sh index 5b29640..0cd52de 100755 --- a/utils/statuses_archiver.sh +++ b/utils/statuses_archiver.sh @@ -7,7 +7,9 @@ for i in "$main_basedir"/all_statuses/$instance/*; do old_check=$(date +'%s' -r "$i"/*.json) if [ $old_check -lt $unixtime_offset ]; then - 7z a -sdel "$main_basedir"/archives/$instance.7z $i + zip -r -m -u -X "$main_basedir"/archives/$instance.zip $i echo "[Archiver] Olded status $i $(date -d "@$old_check") moved to archive" fi done + +find "$main_basedir"/all_statuses/$instance -type d -empty -exec rmdir {} + # Fix not removed empty folder after move (zip bug)