copy : Java Glossary

copy

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:


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/copy.html J:\mindprod\jgloss\copy.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, please quote it and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. Threatening to kill me or spouting obscenities has yet to persuade me to change my mind.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.214]
You are visitor number 11.