Created
February 14, 2018 12:48
-
-
Save wwwutz/16656bd2fd26b44a47961c0243a6f319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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