Posted on 2005-11-17 16:03
Terry的Blog 阅读(5246)
评论(2) 编辑 收藏 所属分类:
java语言
/**
* Moving a File to Another Directory
* @param srcFile eg: c:\windows\abc.txt
* @param destPath eg: c:\temp
* @return success
*/
public static boolean move(String srcFile, String destPath){
// File (or directory) to be moved
File file = new File(srcFile);
// Destination directory
File dir = new File(destPath);
// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
return success;
}