Skip to content

Instantly share code, notes, and snippets.

@kaku87
Created November 14, 2013 00:53
Show Gist options
  • Save kaku87/7459365 to your computer and use it in GitHub Desktop.
Save kaku87/7459365 to your computer and use it in GitHub Desktop.
file copy
/**
* ファイルコピー
* @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