简体   繁体   中英

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. But I want to know the directory of the unzipped files.

Right now, all the files unzipped to C:/Test/. But it has a sub folder "AAAAA".

I want to get this sub folder name "AAAAA" How can I get it?

Try dest.listFiles() . It should give you an array of all files and directories in dest . There are also versions of listFiles that can filter out different kinds of files and/or directories which can be handy at times.

See java api for details: http://docs.oracle.com/javase/7/docs/api/java/io/File.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM