boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.
boolean isFile()
String[] list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.
String[] list(FilenameFilter filter)
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
File[] listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
File[] listFiles(FileFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
File[] listFiles(FilenameFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
Tests whether the file denoted by this abstract pathname is a directory.
boolean isFile()
String[] list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.
String[] list(FilenameFilter filter)
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
File[] listFiles()
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
File[] listFiles(FileFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
File[] listFiles(FilenameFilter filter)
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
你去看看isDirectory()
是否文件夹
isFile()
是否文件
list()
这个是常用的列出所有文件和文件夹的方法
java.io.File里面的
File里面的delete()方法只能删除空文件夹所以你只能递归的删除一个子目录下的所有文件和目录
然后再删除当前的目录,是比较麻烦一点的
boolean mkdir()
Creates the directory named by this abstract pathname.
boolean mkdirs()
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
这两个方法····呵呵,怎么我好像是在复制API了~~