Fix weed.sh script

This allows it to work with the naming convention used by the backup
script.

Fixes: #2753
This commit is contained in:
Wesley Aptekar-Cassels 2023-03-21 20:33:16 -04:00
parent 6d404558c3
commit a0b8adf3a9

View file

@ -84,8 +84,8 @@ function weed_directory {
for date_file in $(
find "$directory" \
-maxdepth 1 \
-name 'backup__[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.sql' \
| sed 's/\(^.*backup__\([0-9-]*\)\.sql$\)/\2\1/' \
-name 'backup_[a-z]*_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.sql' \
| sed 's/\(^.*backup_[a-z]*_\([0-9-]*\)\.sql$\)/\2\1/' \
| sort --reverse
); do
date="${date_file:0:10}"
@ -182,4 +182,4 @@ function main(){
if [ "${BASH_SOURCE[0]}" -ef "$0" ]; then
main "$@"
fi
fi