Example #1
0
File: purge.go Project: jquag/kempt
func runPurge(cfg *conf.Config, path string) error {
	if cfg.PurgeAgeDays > 0 {
		rootCount, err := purgeInFolder(path, cfg.PurgeTime(), cfg.Pattern)
		if err != nil {
			fmt.Printf("Error! Failed to purge files from the root - %s\n", err)
		}

		archiveCount, err := cfg.EachMonth(path, cfg.PurgeTime(), purgeMonth)
		if err != nil {
			fmt.Printf("Error! Failed to purge files from archive month folders - %s\n", err)
		}

		fmt.Printf("purged %d file(s)\n", rootCount+archiveCount)
	}
	return nil
}