From 564e56404e5aecee3924e957adbe95bbb5880676 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 18 Oct 2024 11:10:47 +0300 Subject: also archiving the posts. generally, queueing now should be working --- internal/queue/queue.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/queue/queue.go b/internal/queue/queue.go index 32d645f..caf4f2e 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -27,7 +27,6 @@ func Run(args config.Args) error { } // Queue all *.txt into ./db/*.txt.STAMP.queued -// TODO: This doesn't work correctly yet, neet to test it more! func queueEntries(args config.Args) error { ch, err := oi.ReadDirCh(args.GosDir, func(file os.DirEntry) (string, bool) { filePath := filepath.Join(args.GosDir, file.Name()) @@ -78,8 +77,12 @@ func queuePlatforms(args config.Args) error { if args.DryRun { continue } - log.Println("Removing", filePath) - if err := os.Remove(filePath); err != nil { + archivePath := filepath.Join(args.GosDir, "db", "archive", filepath.Base(filePath)) + log.Printf("Archiving %s -> %s", filePath, archivePath) + if err := oi.EnsureParentDir(archivePath); err != nil { + return err + } + if err := os.Rename(filePath, archivePath); err != nil { return err } } -- cgit v1.2.3