package files import ( "path/filepath" "strings" ) func GetParentDir(fileLocation string) string { fileLocation = filepath.ToSlash(fileLocation) indexOfSlash := strings.LastIndex(fileLocation, "/") if indexOfSlash > 0 { return fileLocation[:indexOfSlash] } return "" }