1、判断文件是否存在
File file = new File("d:\\study\\temp\\test.java"); boolean bl = file.exists();
2、更名文件名
File srcFile = new File("d:\\study\\temp\\test.javav"); File desFile = new File("d:\\study\\temp\\testnew.java"); boolean bln = srcFile.renameTo(desFile);
3、删除文件
File file = new File("d:\\study\\temp\\test.java"); boolean bl = file.exists(); if(file.exists()) { bl = file.delete(); }
4、创建目录
file.mkdir();