Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2014 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/e895d1ec398e9aa8410d to your computer and use it in GitHub Desktop.
Save anonymous/e895d1ec398e9aa8410d to your computer and use it in GitHub Desktop.
Download GoCourseDay pdf files
// http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay1.pdf
package main
import (
"fmt"
"log"
"os/exec"
"strconv"
s "strings"
)
func main() {
fmt.Println("Downloading pdfs")
url_pattern := "http://go.googlecode.com/hg-history/release-branch.r60/doc/GoCourseDay$1.pdf"
for i := 1; i < 4; i++ {
number := strconv.Itoa(i)
download_url := s.Replace(url_pattern, "$1", number, -1)
log.Printf("starting with %s", download_url)
cmd := exec.Command("wget", download_url)
err := cmd.Start()
if err != nil {
log.Fatal(err)
}
err = cmd.Wait()
}
}
@aalemayhu
Copy link

Hmm, looks like I made the gist while not logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment