babillard/data/data.go

25 lines
444 B
Go
Raw Normal View History

package data
import "os"
func ListContenu(path string) ([]string, error) {
var files []string
f, err_open := os.Open(path)
defer f.Close()
if err_open != nil {
return nil, err_open
}
fileInfo, err_read := f.Readdir(-1)
if err_read != nil {
return nil, err_read
}
for _, file := range fileInfo {
if file.Name() != ".gitkeep" && file.Name() != "messages.txt" {
files = append(files, file.Name())
}
}
return files, nil
}