移动文件

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) ;
	}

}

posted on 2015-01-12 18:09  长456风  阅读(160)  评论(0编辑  收藏  举报

导航