antima55 wrote on Jan 7th, 2010, 4:15am:File file = new File("000");
// Destination directory
File dir = new File("data");
"000" won't work because the file is named "000.mov"...
"data" won't work, because it is relative to the location of the class file, somewhere on your temp dir if running from the PDE... I suppose you would use absolute paths, not relative ones.
Note: you can use a single counter and format it with
nf() to get leading zeroes...
So, I would write:
Code:void optag(){
movieName = nf(cnt, 3) + ".mov";
mm = new MovieMaker(this, width, height, movieName ,30, MovieMaker.H263, MovieMaker.HIGH);
// [...]
mm.finish();
// File (or directory) to be moved
File file = saveFile(movieName);
// Destination file
File dest = new File(savePath("data"), movieName);
// Move file to new directory
boolean success = file.renameTo(dest);
if (!success) {
println("not moved");
}
cnt++;
}
noLoop();
}
(untested)
savePath and saveFile are not in the main reference but in the
Developers Reference (
PApplet page).
They give the path to the location of the sketch.
Quote:even better copy to
Curiously, there is no built-in facility to copy files in Java, usual way is to open the file as read, open the dest file as write, and transfer bytes in a loop...