import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; public class CopyFile { public static void main(String[] args) throws IOException { String srcFilePath = "D:/data.csv";//要拷贝的文件路径 String destFilePath = "E:/data.csv";//拷贝后的存放路径 copyFile(srcFilePath,destFilePath); } /** * copy file from srcFilePath to destFilePath * @param srcFilePath 源文件路径 * @param destFilePath 目标文件路径 * @throws IOException */ public static void copyFile(String srcFilePath,String destFilePath) throws IOException { File srcFile=new File(srcFilePath); File destFile=new File(destFilePath); FileUtils.copyFile(srcFile, destFile); } }