@@ 2,10 2,11 @@
package main
import (
+ "fmt"
"io/ioutil"
"log"
"strings"
- "fmt"
+ "time"
"github.com/labstack/echo/v4"
"github.com/olekukonko/tablewriter"
@@ 19,12 20,13 @@ func displayFolder(c echo.Context, path
tableString := &strings.Builder{}
table := tablewriter.NewWriter(tableString)
- table.SetHeader([]string{"TYPE", "NAME", "SIZE"})
+ table.SetHeader([]string{"TYPE", "NAME", "SIZE", "LAST MODIFIED"})
for _, file := range files {
+ lastModified := file.ModTime().Format(time.RFC3339)
if file.IsDir() {
- table.Append([]string{"DIR", file.Name(), ByteCountSI(file.Size())})
+ table.Append([]string{"DIR", file.Name(), ByteCountSI(file.Size()), lastModified})
} else {
- table.Append([]string{"FILE", file.Name(), ByteCountSI(file.Size())})
+ table.Append([]string{"FILE", file.Name(), ByteCountSI(file.Size()), lastModified})
}
}
table.Render()