23 lines
343 B
Go
23 lines
343 B
Go
package os
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// FileExists check file is exists
|
|
func FileExists(name string) bool {
|
|
if _, err := os.Stat(name); err != nil {
|
|
if os.IsNotExist(err) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
// GetFileName return file name
|
|
func GetFileName(file string) string {
|
|
b := strings.Split(file, "/")
|
|
return b[len(b)-1]
|
|
}
|