import java.io.*; public class Copy { public static void main(String[] args) do{ File inf = new File(args[0]); if (!inf.exists()) args[0] = some other input file name; } while (!inf.exists()); FileReader in = new FileReader(f); do{ File ouf = new File(args[1]); if (ouf.exists()) args[1] = some other output file name while (ouf.exists()); FileWriter out = new FileWriter(new uof); int c; do{ c = in.read(); if(c != 1) out.write(c); if (out.full()) // fix some extra room on the disk } while (c != -1); in.close(); if (!in.isClosed) // deal with input file which cannot be closed out.close(); if (!out.isClosed) // deal with output file which cannot be closed } }