Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xcopy(CMD) — OpenDesktop 1.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


     XCOPY(DOS)        UNIX System V         XCOPY(DOS)



     Name
          xcopy - copies files and directories, including lower  level
          directories, if they exist


     Syntax
          xcopy [drive:][path][filename] [drive:][path][filename]
             [/a] [/d:date] [/e] [/m] [/p] [/s] [/v] [/w]


     Description
          The first drive:, path, and filename parameters specify  the
          source  file or directory that you want to copy.  The second
          drive:, path, and filename parameters  specify  the  target.
          You  must include at least one of the source parameters.  If
          you omit the target parameters, xcopy assumes  you  want  to
          copy the files to the default directory.

          If you do not  specify  the  path  option,  xcopy  uses  the
          default directory with the default filename, *.*.

          The switches are:

          /a   Copies source files that have their  archive  bit  set.
               The  switch  does  not  modify  the  archive bit of the
               source file.  See attrib for information on how to  set
               the archive attribute.

          /d   Copies source files that you modified on or  after  the
               date  specified by date.  Note that the date format may
               vary depending on the country code that you are  using.
               See date for more information.

          /e   Copies any subdirectories, even if they are empty.  You
               must use this switch with the /s switch.

          /m   Similar to the /a switch in  that  it  copies  archived
               files  only;  however,  it turns off the archive bit in
               the source file.  See attrib for information on how  to
               set the archive attribute.

          /p   Prompts you with ``(Y/N?)'' to let you confirm  whether
               you want to create each target file.

          /s   Copies  directories  and  lower  level  subdirectories,
               unless  they are empty.  If you omit this switch, xcopy
               works within a single directory.

          /v   Causes xcopy to verify each file as it  is  written  to
               the  target  to  make  sure  that  the target files are
               identical to the source files.

          /w   Causes xcopy to wait before it  starts  copying  files.
               xcopy displays the following message:

               Press any key when ready to start copying files

          You must press a key to continue, or press <CTL>c  to  abort
          the xcopy command.

          Exit Codes

          When correctly written programs exit back  to  MS-DOS,  they
          return  an  exit  code:  0  if no error occurred, or a value
          greater than zero if there was a problem.  This  exit  code,
          which you can test in batch files, lets you ``branch'' to an
          error-handling routine in the batch file.

          If  xcopy  encounters  an  error,  it  returns  one  of  the
          following exit codes:

          0    Copy without error

          1    No files found to copy

          2    <CTL>c entered by user to terminate xcopy

          4    Initialization error.  There is  not  enough  memory  -
               invalid  drive  or command line syntax, file not found,
               or path not found.

          5    Int 24 error occurred.  The  user  aborted  from  INT24
               error reading or writing disk.

          You can  test  for  these  codes  by  using  the  errorlevel
          condition of the batch processing if command.


     Examples
          Because diskcopy copies disks track by track, it  requires
          your  source  and  target disks to have the same format.  If
          you have a disk that contains files  in  subdirectories  and
          you  want  to  copy it to a target disk that has a different
          format, you must use  xcopy.   For  example,  the  following
          command  copies  all the files and subdirectories (including
          any empty subdirectories) on the disk in drive A to the disk
          in drive B:

               xcopy a: b: /s /e

          The xcopy command may prompt  you  to  specify  whether  the
          target  is  a  file  or  a  directory.  If you don't want to
          receive this prompt, enter the following command:

               copy /b xcopy.exe mcopy.exe

          This command creates a new command  called  mcopy.exe.   Now
          you  can  use  mcopy the same way you use xcopy, except that
          mcopy automatically determines whether the target is a  file
          or a directory.

          mcopy uses the following rules for copying files:

          ⊕    If  the  source  is  a  directory,  the  target  is   a
               directory.

          ⊕    If the source includes multiple files, the target is  a
               directory.

          ⊕    If you append a backslash (\) to the end of the target
               name,  the  target  is  a  directory.  For example, the
               following command creates the directory a:\workers,  if
               it  doesn't  already exist, and copies the file payroll
               to it:

               xcopy payroll a:\workers\


     Notes
          xcopy is an external command.


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

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