mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-10 00:30:29 +01:00
Consider prefix rules when pruning WebDAV storages (#79)
This commit is contained in:
parent
4b1127b8c4
commit
5f3832d621
@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -580,6 +581,9 @@ func (s *script) pruneBackups() error {
|
|||||||
var matches []fs.FileInfo
|
var matches []fs.FileInfo
|
||||||
var lenCandidates int
|
var lenCandidates int
|
||||||
for _, candidate := range candidates {
|
for _, candidate := range candidates {
|
||||||
|
if !strings.HasPrefix(candidate.Name(), s.c.BackupPruningPrefix) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
lenCandidates++
|
lenCandidates++
|
||||||
if candidate.ModTime().Before(deadline) {
|
if candidate.ModTime().Before(deadline) {
|
||||||
matches = append(matches, candidate)
|
matches = append(matches, candidate)
|
||||||
|
Loading…
Reference in New Issue
Block a user