if _, err := os.Stat(dir); os.IsNotExist(err) { fmt.Println(dir, "does not exist") } else { fmt.Println("The provided directory named", dir, "exists") }