Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
web_log
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1db55a3b
authored
Jan 06, 2021
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/lic/web_log
Conflicts: utils/util.go
parents
90f8915d
9b4245db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
utils/util.go
utils/util.go
View file @
1db55a3b
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
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment