[英]How to get the unzipped file directory by using TrueZip
public class unzipAll {
public static void main(final java.lang.String[] args) throws Exception{
TFile src = new TFile("C:/1/BULK.tar.gz");
File dest = new File("C:/Test/");
dest.mkdirs();
try {
src.cp_rp(dest);
TVFS.umount();
} catch (IOException e) {
e.printStackTrace();
}
}
}
I can use this code to unzip BULK.tar.gz. 我可以使用此代码解压缩BULK.tar.gz。 But I want to know the directory of the unzipped files.
但是我想知道解压缩文件的目录。
Right now, all the files unzipped to C:/Test/. 现在,所有文件都解压缩到C:/ Test /。 But it has a sub folder "AAAAA".
但是它有一个子文件夹“ AAAAA”。
I want to get this sub folder name "AAAAA" How can I get it? 我想获得此子文件夹名称“ AAAAA”如何获取?
Try dest.listFiles()
. 尝试
dest.listFiles()
。 It should give you an array of all files and directories in dest
. 它应该为您提供
dest
中所有文件和目录的数组。 There are also versions of listFiles
that can filter out different kinds of files and/or directories which can be handy at times. 还有一些版本的
listFiles
可以过滤掉有时方便的各种文件和/或目录。
See java api for details: http://docs.oracle.com/javase/7/docs/api/java/io/File.html 有关详细信息,请参见Java api: http : //docs.oracle.com/javase/7/docs/api/java/io/File.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.