Skip to content

Instantly share code, notes, and snippets.

@uemuraj
Created April 25, 2014 01:06
Show Gist options
  • Save uemuraj/11274778 to your computer and use it in GitHub Desktop.
Save uemuraj/11274778 to your computer and use it in GitHub Desktop.
jrunscript で UNZIP する
importPackage(java.io);
importPackage(java.util.zip);
for (i = 0; i < arguments.length; i++) {
var zip = new ZipFile(new File(arguments[i]));
var entries = zip.entries();
while (entries.hasMoreElements()) {
var entry = entries.nextElement();
if (entry.isDirectory()) {
mkdirs(entry.getName());
} else {
cp(zip.getInputStream(entry), new File(entry.getName()));
}
}
zip.close();
}
@uemuraj
Copy link
Author

uemuraj commented Apr 25, 2014

使い方はこんな感じ:

jrunscript -f unzip.js xyz.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment