Add golang file utilities

This commit is contained in:
chteufleur 2015-08-25 14:41:58 +02:00
parent ff960c210e
commit b17441bd38
1 changed files with 34 additions and 0 deletions

34
Golang/fileUtils.go Normal file
View File

@ -0,0 +1,34 @@
func IsFileExist(path string) (bool) {
finfo, err := os.Stat(path)
if err != nil {
return false
} else {
return true
}
}
func IsFile(path string) (bool) {
finfo, err := os.Stat(path)
if err != nil {
return false
}
if finfo.IsDir() {
return false
} else {
return true
}
}
func IsDirectory(path string) (bool) {
finfo, err := os.Stat(path)
if err != nil {
return false
}
if finfo.IsDir() {
return true
} else {
return false
}
}