-
Download the library
Commons IO – Download Apache Commons IO -
Create a folder called ‘code’ in your ‘Sketch folder’.
-
After that, put the downloaded file in the ‘code’ file.
-
Source Code
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
void setup(){
size(500,500);
try {
String url1 = dataPath("")+"/test.txt";
String url2 = "C://Users\\user\\Desktop/test.txt";
File files = new File(url1);
File newFile = new File(url2);
FileUtils.copyFile(files, newFile);
}
catch (Exception e) {
println("Error in saving the file...sorry!");
}
}