Created
January 8, 2015 08:57
-
-
Save mshr-h/73178e68e6a50035e2e8 to your computer and use it in GitHub Desktop.
Print the contents of a zip archive.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"archive/zip" | |
"fmt" | |
"os" | |
) | |
func main() { | |
var r *zip.ReadCloser | |
var filename string | |
if len(os.Args) < 2 { | |
return | |
} | |
filename = os.Args[1] | |
r, err := zip.OpenReader(filename) | |
if err != nil { | |
return | |
} | |
for _, f := range r.File { | |
fmt.Println(f.Name) | |
} | |
defer r.Close() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment