copy : Java Glossary


Computers spend a considerable amount of time copying files, often with a command called COPY built into the script processor. In Linux, the copy command is called cp. COPY uses the CWD (Current Working Directory) as both the default for the source of the files and the target. This is rarely what you want, but that is the tradition and hardly anyone questions it.

Windows is a case-insensitive operating system, but that does not mean you can forget about case. For example, Let us assume you have a file called Abc.txt in C:\temp, and a file called aBc.txt in D:\temp and you type copy C:\temp\abC.txt D:\temp. What is the name of the file in D:\temp when you are done?

  1. Abc.txt
  2. aBc.txt
  3. abC.txt
  4. abc.txt
  5. ABC.txt

Hint, the answer rhymes with the most popular word in advertising.

Nothing could be simpler conceptually than copying a file, but to do it efficiently is surprisingly complex. It is easy and common to write appallingly bad copy code, and I have seen a lot of it over the years. I think the problem is modern programmers treat the OS (Operating System) and the hardware like a black box. In the olden days, when I cut my teeth, every programmer had to be intimately aware of just was going on physically inside hard disks and OSes. With a realistic mental model of what is going on under the hood, you would never dream of writing some of the silly copying code I have seen. If you write your own COPY, or have a COPY function included in some other program, there are several things to consider:

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Your face IP:[]
You are visitor number