func main() {
// Open a zip archive for reading.
r, err := zip.OpenReader("e:\\demo.zip")
if err != nil {
log.Fatal(err)
}
defer r.Close()
for _, f := range r.File {
if f.FileInfo().IsDir() {
fmt.Println(f.Name, "folder")
} else {
fmt.Println(f.Name, "file")
}
}
}
out:
loading/ folder
loading/loading.html file
loading.css file
I want:
loading/ folder
loading.css file
I just need to get the list of compressed file contents.
The program will print out all files, can subfolders be excluded,or have to handle it myself?