copy : Java Glossary

Introduction Futures
Case Sensitivity Links
Under the Hood


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. Take Command also has a copy command. Another common copy command is xcopy, specialised for copying trees of files. Note the command is just plain copy, not copy.exe. It is an internal command built into the command processor, not a separate executable.

Case Sensitivity

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

The answer is (2)

Under the Hood

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:


Copying is such a fundamental operation, it should be built into the OS. Why?

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