public static List<AEMPackage> processPackageFo(FileObject packagesFo) throws Exception { List<AEMPackage> res = new ArrayList<AEMPackage>(); for (FileObject groupFo : packagesFo.getChildren()) { if (groupFo.isFolder()) { String groupName = groupFo.getName(); if (groupName.equalsIgnoreCase("day")) { continue; } if (groupName.equalsIgnoreCase("adobe")) { continue; } for (FileObject pkgFo : groupFo.getChildren()) { System.out.println(groupFo.getPath() + "" + pkgFo.getName()); AEMPackage pkg = processPackage(pkgFo); if (pkg != null) { res.add(pkg); if (pkg.getName().contains("navy")) { FileWriter fw = new FileWriter( "/Volumes/MacData/jakaniew/git/Adobe/Custom-Demos/navy-dam/" + pkg.getName() + ".xml"); StringBuilder sb = new StringBuilder(); pkg.toXML(sb); fw.append(sb); fw.close(); } } } } } return res; }