+ logMsg := func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: removed", path)
+ }
+ if everything {
+ ctx.LogI("rm", nncp.LEs{{K: "File", V: path}}, logMsg)
+ if *dryRun {
+ return nil
+ }
+ return os.Remove(path)
+ }
+ if now.Sub(info.ModTime()) < oldBoundary {
+ ctx.LogD(
+ "rm-skip", nncp.LEs{{K: "File", V: path}},
+ func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: too fresh, skipping", path)
+ },
+ )
+ } else if !*dryRun {
+ return os.Remove(path)
+ }
+ return nil
+ },
+ )
+ }
+ if *doRx || *doSeen {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TRx), nncp.SeenDir,
+ ), *doSeen); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *doRx || *doHdr {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TRx), nncp.HdrDir,
+ ), *doHdr); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *doTx || *doHdr {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TTx), nncp.HdrDir,
+ ), *doHdr); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *doArea {
+ if err = filepath.Walk(
+ filepath.Join(ctx.Spool, node.Id.String(), nncp.AreaDir),
+ func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return err
+ }
+ if info.IsDir() {