next up previous contents
Next: Moving/Renaming Files Up: Basic File Commands Previous: Naming Files

Copying Files

There are three basic forms of the copy command:

The first form (with default options) creates a new file at the location specified by the tofile path, or it overwrites a file of the same name if that file already exists (and that existing file has a mode that allows writing). To prevent the unwanted destruction of a same-named file, use the -i option. This option causes an interactive prompt to appear if there are any filename conflicts.

The second form is like the first, except that no filename is specified, just a target directory. In this case the source file is copied to the target directory, and the name of the source file is preserved. Again, if a file already exists in the target directory that has the same name as the source file, it will be overwritten unless you specify the -i option.

The third form works two ways to recursively copy all files and subdirectories in the source directory to the target directory. If the target directory exists before the copy, then the source directory will become a subdirectory of the target directory. If the target directory does not exist, then the source directory is simply copied and given the todirectory name at the destination. Be as careful of recursive copying as recursive deletion, since a statement like the following will cause a recursive copy that won't stop until the disk is full or until you have exhausted your disk quota:


cp -r  lisp/tools 		lisp/tools/parser

next up previous contents
Next: Moving/Renaming Files Up: Basic File Commands Previous: Naming Files
World Wide Web Administrator
1/5/1999