+ if *pktRaw != "" || *doRx || *doSeen || *doNoCK || *doHdr || *doPart {
+ if err = remove(nncp.TRx); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *pktRaw != "" || *doTx || *doHdr {
+ if err = remove(nncp.TTx); 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() {
+ return nil
+ }
+ 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)
+ })
+ return nil
+ }
+ if strings.HasSuffix(info.Name(), nncp.SeenSuffix) {
+ ctx.LogI(
+ "rm",
+ nncp.LEs{{K: "File", V: path}},
+ func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: removed", path)
+ },
+ )
+ if *dryRun {
+ return nil
+ }
+ return os.Remove(path)
+ }
+ return nil
+ }); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }