Skip to content

Instantly share code, notes, and snippets.

@wwwutz
Created February 14, 2018 12:48
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 wwwutz/16656bd2fd26b44a47961c0243a6f319 to your computer and use it in GitHub Desktop.
Save wwwutz/16656bd2fd26b44a47961c0243a6f319 to your computer and use it in GitHub Desktop.
package main
import "fmt"
import "os"
func main() {
path := `F:\BOOM`
dir, err := os.Stat(path)
if err == nil {
if dir.IsDir() {
fmt.Printf("Found folder %s. Lets see what happens now.\n", path)
}
}
path = `\\?\F:\BOOM\BANG`
// this will fail
err = os.MkdirAll(path, 448)
if err != nil {
fmt.Printf("1 failed: MkdirAll( %v , perm ) err = %v\n", path, err)
}
path = `\\?\F:\BOOM`
// this will fail also
err = os.MkdirAll(path, 448)
if err != nil {
fmt.Printf("2 failed: MkdirAll( %v , perm ) err = %v\n", path, err)
}
path = `F:\BOOM\BANG`
// this will succeed, no UNC prefix
err = os.MkdirAll(path, 448)
if err != nil {
fmt.Printf("3 failed: MkdirAll( %v , perm ) err = %v\n", path, err)
} else {
fmt.Printf("done: MkdirAll( %v , perm ) err = %v\n", path, err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment