Archive : Prune fix name matching.

This commit is contained in:
Dmitry Voronin 2024-02-18 18:36:41 +03:00
parent 418f4799c3
commit 4e882b0dda

View file

@ -1,5 +1,5 @@
export _archive_pattern="_[0-9]{12}-[[:alnum:]]{40}.t[xg]z"
export _archive_pattern_fast="_[0-9]{12}-[[:alnum:]]{40}.tgz"
export _archive_pattern="_[0-9]{12}-[[:alnum:]]{40}.t[xg]z$"
export _archive_pattern_fast="_[0-9]{12}-[[:alnum:]]{40}.tgz$"
# Archive directories.
# All directories by default.
@ -131,7 +131,7 @@ function archive_prune() {
fi
process() {
local prune=($(ls ${target}* | _filter_archive | sort -r | sed -e "1,${versions}d"))
local prune=($(ls | grep -E "^${target}${_archive_pattern}" | sort -r | sed -e "1,${versions}d"))
for archive in ${prune[@]}; do
rm -- "${archive}" && echo "${archive}"