Commit 1db55a3b by lichenggang

Merge branch 'master' of http://119.23.72.7/lic/web_log

 Conflicts:
	utils/util.go
parents 90f8915d 9b4245db
Showing with 19 additions and 0 deletions
package utils
import (
"encoding/json"
"io/ioutil"
"os"
)
......@@ -26,3 +27,21 @@ func Get_files(direct_path string) ([]string, error) {
}
return li_file, nil
}
// (fileSize string, lastTime string)
func PathFileInfo(path string) string {
files, _ := ioutil.ReadDir(path)
var index int
var infos = make([]map[string]interface{}, len(files))
for _, file := range files {
infos[index] = make(map[string]interface{})
infos[index]["file_size"] = file.Size()
infos[index]["last_modify"] = file.ModTime().Unix()
infos[index]["file_name"] = file.Name()
index++
}
data, _ := json.Marshal(infos)
return string(data)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment