home *** CD-ROM | disk | FTP | other *** search
/ Big Blue Disk 5 / bbd05.zip / CP.DOC < prev    next >
Text File  |  1987-01-07  |  6KB  |  154 lines

  1. ^C^1The CP Command
  2. ^C(Copy files)
  3. ^CWorks on Rainbow or IBM PC
  4. ^CVersion 2.2
  5.  
  6. The CP command is a replacement for the MS-DOS COPY command.  It performs the 
  7. same basic functions, but has a number of additional features and enhance-
  8. ments, which are discussed below.  In addition, CP is able to copy files that 
  9. give COPY trouble, including zero-length files, filenames with non-standard 
  10. characters not normally allowed by DOS, etc. 
  11.  
  12.  
  13. ^CSYNTAX
  14.  
  15. The syntax of CP is as follows:
  16.  
  17.                 cp [-diqv!] file,file,... target
  18.  
  19. Options are given as "switches."  Each option has an associated letter, and
  20. you should enter the options you wish to use as a series of one or more letters
  21. preceded by a hyphen (-).
  22.  
  23. File specifications may contain a drive and/or a directory specification and 
  24. wildcard characters.  The target specification is a file name or a drive 
  25. and/or directory name.  Wildcard characters are not permitted in the target.
  26.         
  27. If more than one file is being copied (for example, when a list of source 
  28. file names is given, or wildcard characters are used), the target must be a 
  29. drive and/or directory name only. The file name of each file copied is used to 
  30. make the target file name. 
  31.         
  32. If a source file specification contains a drive and/or directory, these are 
  33. passed along to the subsequent source file specifications until reassigned; 
  34. thus 
  35.         
  36.                 cp \src\*.c,*.obj,\exe\*.* b:
  37.         
  38. is the same as 
  39.         
  40.                 cp \src\*.c,\src\*.obj,\exe\*.* b:
  41.         
  42. and 
  43.         
  44.                 cp b:bob,carol,\tmp\ted,alice \bed
  45.         
  46. is shorthand for 
  47.         
  48.                 cp b:bob,b:carol,b:\tmp\ted,b:\tmp\alice \bed
  49.         
  50. If a target file exists, CP normally asks for verification before overwriting. 
  51.         
  52. If there is not enough room on the target disk for the copy, the program pauses 
  53. while the user changes disks; the copy then proceeds. 
  54.  
  55.  
  56. ^COPTIONS
  57.  
  58. Option:        -d (delete after copy)
  59.  
  60. The source file is deleted without confirmation if the copy was successful. 
  61.  
  62. Option:        -i (input)
  63.  
  64. The list of files to copy is taken from the standard input device (normally 
  65. the keyboard, but redirectible through use of MS-DOS filter operators) rather 
  66. than the command line.  Thus with -i the format of cp is 
  67.  
  68.                 cp -i [-dqv!] target
  69.  
  70. This is useful when using cp as a filter, a powerful MS-DOS feature which 
  71. allows the output of one program to be channeled to become the input of 
  72. another.  This is one of the places where you can use two Kramden Utilities in 
  73. combination.  If you have the LS command (a powerful directory listing command 
  74. included in issue 4 of BIG BLUE DISK), you can use CP as a filter acting on 
  75. the output of LS like this: 
  76.  
  77.                 ls -fm||cp -i a:
  78.  
  79. This line uses the MS-DOS filter operator "||" to send the output of the 
  80. command to the left of the bar (ls -fm) into the command to the right (cp -i 
  81. a:).  The result of this particular command is to copy files in order from 
  82. smallest to largest.  This insures that the most files will be copied to drive 
  83. a: before it fills. 
  84.  
  85. There are lots of other ways you can use this combination of utilities.  If 
  86. you wish to copy selected files in some particular order or according to some 
  87. particular criterion, you can devise an LS command sequence which generates a 
  88. list of the files you wish to copy, in the order you wish them copied, and 
  89. pipe it into CP as shown above. 
  90.  
  91. Another use for this option is to copy a list of files given in another file.  
  92. For example, if the file "FILES.LST" contains a list of filenames, one on each 
  93. line, then the command 
  94.  
  95.                 cp -i a: <files.lst
  96.  
  97. will cause the listed files to be copied to drive a:.  This uses the MS-DOS 
  98. redirection operator "<" to send the contents of the file FILES.LST as the 
  99. input to CP.  In general, "<" followed by a file or device name will cause 
  100. input to the command to be taken from the given file or device; conversely, ">"
  101. followed by a file or device name sends output from the command to the file or 
  102. device.
  103.  
  104.  
  105. Option:        -q (quiet)
  106.                 
  107. Supresses informational copy messages. 
  108.         
  109. Option:        -v (verify)
  110.                 
  111. Causes user confirmation to be requested before copying.  At each file prompt 
  112. the user answers either Y (do the copy), ! (do the copy and don't ask for 
  113. confirmation on future files), or N (don't copy this file).  Any other answer 
  114. is the same as N. 
  115.         
  116. Option:        -! (hammer!)
  117.                 
  118. Supresses the verification which is normally requested (even without -v) before 
  119. overwriting an existing file. 
  120.  
  121. Options may be combined as in 
  122.  
  123.                 cp -q! ...
  124.  
  125.  
  126. ^CHINTS AND TIPS
  127.  
  128. Since the "-" character is used to indicate command options, filenames which 
  129. begin with a hyphen must be preceded by a drive or path specification so they 
  130. are not mistaken for command switches.  Thus, for instance, if you wish to 
  131. copy one of the directory delimiter files from BIG BLUE DISK, the direct 
  132. command "cp --------.000 b:" won't work; you should type it with a path, like
  133. "cp .\--------.000 b:".  (The path ".\" always refers to the current directory.)
  134.  
  135. When you copy with wildcards, like "cp *.* b:", there won't be any problem
  136. copying files beginning with hyphens.  Also, zero-length files such as the
  137. directory delimiters will copy with no problem; the COPY command won't handle
  138. them, but CP works fine.  
  139.  
  140. If your disk has files containing spaces in their filename (DOS won't create 
  141. them, but BASIC can), there is no way to type the filename in a CP expression 
  142. (since the space is used as a separator); however, if you use a wildcard
  143. expression like "*.*", these files will be copied, unlike the DOS COPY command,
  144. which seems to choke on such files even within wildcards.
  145.         
  146. The CP! command is a shorthand for cp -!.  Usage is 
  147.         
  148.                 cp! [-diq] file,file,... target
  149.  
  150.  
  151.                   Copyright (c) 1985,1986, by Bryan Higgins.
  152.  
  153. DISK FILE THIS PROGRAM USES:   CP.EXE
  154.