aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-19 15:51:41 +0200
committerMax Magorsch <arzano@gentoo.org>2020-06-19 15:51:41 +0200
commit21181c518cf41828917d36005b726f9452fde657 (patch)
tree38fab1b3c86a41383e48be6b2686d92efd86db62 /pkg/importer/importer.go
downloadarchives-21181c518cf41828917d36005b726f9452fde657.tar.gz
archives-21181c518cf41828917d36005b726f9452fde657.tar.bz2
archives-21181c518cf41828917d36005b726f9452fde657.zip
Initial version
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg/importer/importer.go')
-rw-r--r--pkg/importer/importer.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/importer/importer.go b/pkg/importer/importer.go
new file mode 100644
index 0000000..a989238
--- /dev/null
+++ b/pkg/importer/importer.go
@@ -0,0 +1,24 @@
+package importer
+
+import (
+ "archives/pkg/config"
+ "log"
+ "os"
+ "path/filepath"
+)
+
+func FullImport() {
+ err := filepath.Walk(config.MailDirPath(),
+ func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if !info.IsDir() && getDepth(path, config.MailDirPath()) >= 1 {
+ importMail(info.Name(), path, config.MailDirPath())
+ }
+ return nil
+ })
+ if err != nil {
+ log.Println(err)
+ }
+}