Created
November 14, 2013 00:53
-
-
Save kaku87/7459365 to your computer and use it in GitHub Desktop.
file copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ファイルコピー | |
* @param srcPath | |
* @param destPath | |
* @throws IOException | |
*/ | |
private void csvFileCopy(String srcPath, String destPath) throws IOException { | |
NetworkFile srcFile = new NetworkFile(srcPath); | |
NetworkFile destFile = new NetworkFile(destPath); | |
if (!srcFile.exists()){ | |
return; | |
} | |
if (destFile.exists()){ | |
Long fileCount = new Long(0); | |
boolean check = true; | |
while(check){ | |
String newDestPath = destPath + fileCount.toString(); | |
NetworkFile newDestFile = new NetworkFile(newDestPath); | |
if(newDestFile.exists()){ | |
fileCount++; | |
} | |
else{ | |
//newDestFile.write(srcFile.read()); | |
newDestFile.save(srcFile.load()); | |
check = false; | |
} | |
} | |
// destFile.append(srcFile.read()); | |
} | |
else{ | |
//destFile.write(srcFile.read()); | |
destFile.save(srcFile.load()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment