Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ copy(CMD) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


     COPY(DOS)         UNIX System V          COPY(DOS)



     Name
          copy - copies and appends files


     Syntax
          copy [drive:] pathname [drive:][pathname][/v] [/a] [/b]

          (to copy files)

          copy pathname + pathname ...
          (to append files)


     Description
          If you do not specify  the  second  pathname,  the  copy  is
          created  on  the  default drive and has the same name as the
          original file (first pathname). If the original file  is  on
          the  default  drive  and  you  do  not  specify  the  second
          pathname, copy quits (you are not allowed to copy a file  to
          itself), and MS-DOS displays the following error message:

               File cannot be copied onto itself
               0 File(s) copied

          If the source and target  files  are  both  in  the  working
          directory,   you  may  use  filenames  instead  of  complete
          pathnames.

          The second drive:pathname option may take one of three
          forms:

          ⊕    If the second option  is  a  drive  name  only,  MS-DOS
               copies  the  original  file  to  the  designated drive,
               keeping  the  original  filename.   For  example,   the
               following  command  makes  a  copy  on  drive  B  named
               memo.doc:

               copy memo.doc b:

          ⊕    If the second option is a filename only, MS-DOS  copies
               the  original  file  to  one  on the default drive, and
               renames it with the specified filename.   For  example,
               the following command makes a copy of memo.doc, names
               it letter.doc, and places it on the default drive:

               copy memo.doc letter.doc

          ⊕    If the second option  includes  a  drive  name,  MS-DOS
               copies the original file to one on the specified drive.
               For example, the following  command  makes  a  copy  of
               memo.doc  on  the  default drive, names the copy
               letter.doc, and places the copy on the disk in drive B:

               copy memo.doc b:letter.doc

          The /v switch causes  MS-DOS  to  verify  that  the  sectors
          written on the target disk are recorded properly.  If MS-DOS
          cannot  verify  a  write,  it  displays  an  error  message.
          Although  there  are  rarely  recording  errors when you run
          copy, the /v switch lets you verify that critical  data  has
          been  correctly recorded; it also makes the copy command run
          more slowly because MS-DOS must check each entry recorded on
          the disk.

          The /a or /b switch lets you copy  either  ASCII  or  binary
          files,  respectively.   Each  switch applies to the filename
          preceding it, and to all remaining filenames in the command,
          until copy encounters another /a or /b switch.


     Examples
          When used with a source filename:

          /a  Causes the file to be treated as an ASCII  (text)  file.
              Data  in  the file is copied up to but not including the
              first end-of-file mark (in edlin this is  <CTL>z).   The
              remainder of the file is not copied.

          /b  Causes the entire file to be copied, including any  end-
              of-file marks.

          When used with a target filename:

          /a  Causes an end-of-file character to be added as the  last
              character of the file; for example:

               copy memo.doc /a letter.doc

          /b  Does not add an end-of-file character; for example:

               copy billing.asm /b billing2.asm

          When you are appending files the default  switch  is  always
          /a.

          The copy command also allows you to  append  files.   To  do
          this you simply list any number of files as options to copy,
          each separated by a plus sign (+),  then  specify  a  target
          file to send the combined files to; for example:

               copy intro.rpt + body.rpt + b:sum.rpt report

          This command combines files named intro.rpt,  body.rpt,  and
          sum.rpt  (on  drive  B),  and  places  them in a file called
          report on the default drive.  If you leave  out  the  target
          file,  MS-DOS  combines  the  files into the first specified
          file.

          You can  also  combine  several  files  into  one  by  using
          wildcards; for example:

               copy *.txt combin.doc

          This command takes all files with an extension of  .txt  and
          combines them into one file named combin.doc.

          In he following example, each file that  matches  *.txt  is
          combined  with its corresponding .ref file.  The result is a
          file with the same filename but  with  the  extension  .doc.
          Thus,   file1.txt   is   combined  with  file1.ref  to  form
          file1.doc, xyz.txt with xyz.ref to form xyz.doc, and so on:

               copy *.txt + *.ref *.doc

          The following command combines all files matching *.txt  and
          all files matching *.ref into one file named combin.doc:

               copy *.txt + *.ref combin.doc

          Do not try to append files if one of  the  source  filenames
          has  the  same extension as the target.  For example, if the
          file all.txt already exists, the  following  command  is  an
          error:

               copy *.txt all.txt

          MS-DOS would not detect the error until it tried  to  append
          all.txt.   But  at  that  point,  copy  might  have  already
          destroyed the all.txt file.

          copy compares the  filename  of  the  input  file  with  the
          filename  of  the  target.   If  they are the same, that one
          input file is skipped, and MS-DOS prints the  error  message
          ``Content   of  destination  lost  before  copy.''   Further
          joining  proceeds  normally.   For  example,  the  following
          command appends all *.txt files (except all.txt) to all.txt:

               copy all.txt + *.txt

          This command will not produce an error message.

          If you want to copy files and subdirectories, you should use
          xcopy.   Refer to xcopy in this chapter for more information
          on how to do this.


     Notes
          copy is an internal command.


     COPY(DOS)            (printed 8/16/89)             COPY(DOS)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026