I want, if you try to copy to the directory, a message is displayed and the program shuts down. In the case of a file, display the file size and the time it was last modified. I don't know exactly, how can i show out file size, and last time modified. ..............................................................................................................................................................
import java.io.*;
public class KopeeriFail {
private static void kopeeri(String start, String end) throws Exception {
InputStream sisse = new FileInputStream(start);
OutputStream välja = new FileOutputStream(end);
byte[] puhver = new byte[1024];
int loetud = sisse.read(puhver);
while (loetud > 0) {
välja.write(puhver, 0, loetud);
loetud = sisse.read(puhver);
}
sisse.close();
välja.close();
}
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.out.println("Did you gave name to the file");
System.exit(1);
}
kopeeri(args[0], args[0] + ".copy");
}
}