I am building a class that handles files. When I call
Perhaps the copy is not really complete? Thanks in advance for help. I'm a newbie so any comments are welcome.
import java.io.*;
public class mainMethod {
public static void main(String args[]) throws Exception {
// this works...
Item item = new Item("/Users/kevin/Desktop/BOS70085_2up.pdf");
item.renameSelf("boo.pdf");
item.copySelfWithInit(new File("/Users/kevin/Desktop/Fonts/"));
//this causes file to disappear...
Item item = new Item("/Users/kevin/Desktop/BOS70085_2up.pdf");
item.copySelfWithInit(new File("/Users/kevin/Desktop/Fonts/"));
item.renameSelf("boo.pdf");
}
}
-------------------------------------------------
import java.io.*;
public class Item {
private File file;
public Item(String itemPath) {
file = new File(itemPath);
} // end Item();
public void renameSelf(String n) {
File t = new File(file.getParent() + "/" + n);
file.renameTo(new File(n));
file = t;
} // end renameSelf()
public void copySelfWithInit( File dest) throws IOException {
File newFile = new File(dest.getPath() + "/" + file.getName());
CopyFile cp = new CopyFile(file, newFile);
cp.copy();
file = newFile;
} // end copySelf()
}
--
Kevin Muldoon, Owner
TrueBlueDot - Fine Art Printing
New Haven, CT 06511
"Our pigment meets your imagination"