public static String addFiles(BlobStore store, String dir) throws Exception {
ArrayList<String> list = new ArrayList<String>();
String root = new File(dir).getAbsolutePath();
String parent = new File(dir).getParentFile().getAbsolutePath();
addFiles(list, new File(root));
JsopBuilder listing = new JsopBuilder();
listing.object();
for (String f : list) {
FileInputStream in = new FileInputStream(f);
String id = store.writeBlob(in);
in.close();
String name = f.substring(parent.length());
listing.key(name).value(id);
listing.newline();
}
listing.endObject();
String l = listing.toString();
String id = store.writeBlob(new ByteArrayInputStream(l.getBytes("UTF-8")));
return id;
}