列出给定根目录中的所有文件和文件夹。
import java.io.*;/* 来 自 n o w j a v a . c o m*/ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; import javax.swing.filechooser.FileFilter; public class Main{//时代Java公众号 - N o w J a v a . c o m /** * List all files and folders from the given root. * * @param root * The root of the listing * @return A list of the files under the given root */ public static List<File> listFilesRecursive(final File root) { List<File> packedFiles = new ArrayList<File>(); File[] subFiles = root.listFiles(); if (subFiles == null) { return packedFiles; } for (File file : subFiles) { if (file.isFile()) { File packedFile = new File(root, file.getName(