Created
February 6, 2015 08:01
-
-
Save magicianzrh/8867607c25937646ee8e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func checkFolderFileName(p_path string) { | |
reg, err := regexp.Compile(`^[a-zA-Z0-9._/-]{1,100}$`) | |
if err != nil { | |
log.Fatal(err) | |
} | |
filepath.Walk(p_path, func(path string, fi os.FileInfo, err error) error { | |
if fi == nil { | |
return err | |
} | |
if fi.IsDir() { | |
return nil | |
} | |
if !reg.MatchString(fi.Name()) { | |
fmt.Println("file name err:" + fi.Name()) | |
} | |
return nil | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment