[Solved]Need some help with a copy command in a shell
Hi, I'm writing a simple Shell using Java for Windows for a uni course. So far things have been pretty straight forward using the java File class, I've made dir, cd, cd.. and a couple of other commands. Now on to the question:
I'm trying to make a copy command to copy a file and select a destination for it.
So far I've gotten by using the File class but I don't see anything in the class to copy a file. I tried using the boolean renameTo(String destination) command but it's not working (for some reason I haven't been able to figure out). I'd really appreciate some help with this
test returns false, and I can't figure out why. Can anyone think of another way for me to copy a file to a specific destination?
File file1 = new File(currentPath);
File file2 = new File("C:\\");
boolean [B]test[/B] = file1.renameTo(file2);
System.out.println("This file already exists and/or move operation failed");
Thanks for your time, hopefully someone can help me out!
Edit: Can't seem to edit the thread name to add a [solved] tag, is that a moderator thing or am I blind, heh.