Мне нужно создать tar-файл, в котором будут каталоги и файлы.Пример:
while(itr.hasNext()) {
String dir = itr.next();
File f = new File("/tmp/apps/"+dir);
f.getParentFile().mkdirs();
File contentFile = new File(f, "myfile.txt");
if(!contentFile.exists()) {
contentFile.createNewFile();
}
Writer out = new FileWriter(contentFile);
BufferedWriter bw = new BufferedWriter(out);
bw.write(someString);
bw.close();
}
//tar the content from /tmp/apps as apps.tar which sould have some directories
and files