示例#1
0
文件: archive.go 项目: jquag/kempt
func zipArchives(cfg *conf.Config, dirStr string) error {
	//subtract a month so we don't zip the month represented by current date - ZipAgeDays
	maxTime := cfg.ZipTime().AddDate(0, -1, 0)
	count, err := cfg.EachMonth(dirStr, maxTime, zipArchive)
	if err == nil {
		fmt.Printf("Zipped %d folder(s)\n", count)
	}
	return err
}
示例#2
0
文件: purge.go 项目: 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
}