package cut; import java.io.File; import java.util.Arrays; /** * 移动文件 * @author Administrator * */ public class FjleCut { public static void main(String[] args) { // TODO Auto-generated method stub String root = "J:\电影\"; File file = new File(root); String [] filenames = file.list(); // System.out.println(Arrays.toString(filenames)); for(String name: filenames){ File tempfile = new File(root+name); if(tempfile.isFile() && name.endsWith("rmvb")){ System.out.println(name); File newfile = new File("J:\电影\RMVB\" + name); tempfile.renameTo(newfile); } } // renameTo(File dest) ; } }