diff options
author | Jordan <me@jordan.im> | 2022-02-10 14:13:57 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-02-10 14:13:57 -0700 |
commit | 6df82fabcc0053637fdc0f02e3669cd5fa21cb46 (patch) | |
tree | 7058a7aacda028c4719622c3ea68a59480524505 | |
parent | 392cd30dda49503c967b1239f72fe53b98ba63cc (diff) | |
download | crawl-6df82fabcc0053637fdc0f02e3669cd5fa21cb46.tar.gz crawl-6df82fabcc0053637fdc0f02e3669cd5fa21cb46.zip |
crawl: include crawl start date in directory name
-rw-r--r-- | cmd/crawl/crawl.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/crawl/crawl.go b/cmd/crawl/crawl.go index b3ab049..f2c4394 100644 --- a/cmd/crawl/crawl.go +++ b/cmd/crawl/crawl.go @@ -309,13 +309,15 @@ func main() { log.Fatal(err) } } else { - if _, err := os.Stat(host); os.IsNotExist(err) { - err := os.Mkdir(host, 0700) + shortForm := "2006-01-02" + d := host+"-"+time.Now().Format(shortForm) + if _, err := os.Stat(d); os.IsNotExist(err) { + err := os.Mkdir(d, 0700) if err != nil { log.Fatal(err) } } - err := os.Chdir(host) + err := os.Chdir(d) if err != nil { log.Fatal(err) } |