在执行任何任务之前想要将文件复制/备份到目标文件夹。(jdk-1.7)
/*Input file path taken from properties file as string is :inputFile
where-in inputFile is :C:\\Project\\input\\filename.txt
Destination file path taken from properties file as string is :
archiveFolderPath */
//Existing code : in main
if (inputFile != null) {
readTextFile(new File(inputFile)); }
// in readTextFile method
BufferedReader br = new BufferedReader(new FileReader(filename));
我尝试使用以下过程::但出现错误:错误::文件类型中的方法复制(InputStream,OutputStream)不适用于参数(字符串,字符串)
//Calling method in main::
copyFiles(inputFile, archiveFolderPath);
//Copy method :
private static void copyFiles (String inputFile, String
archiveFolderPath) throws IOException {
Files.copy(inputFile, archiveFolderPath); }
请建议替代解决方案,如“文件不适用于参数(字符串,字符串)”。
蝴蝶不菲
相关分类