# copy |

## Description

Copy a file or fileset to a new file or directory. Files are only copied if the source file is newer than the destination file, or when the destination file does not exist.

## Parameters

file
  Description: File to be copied

  Domain: Valid filename pointing to existing file

  Default: -

to_file
  Description: File to copy to

  Domain: Valid filename

  Default: -

to_directory
  Description: Directory to which file(s) should be copied to

  Domain: Valid directoryname pointing to existing directory

  Default: -

force
  Description: Copy file even when the possibly existing target file is not out of date.

  Domain: Boolean (true|false)

  Default: false

## RNG Specification

      <define name="copy">
        <element name="copy">
          <ref name="dir_if_unless"/>
            <choice>
              <group>
                <attribute name="file"/>
                <attribute name="to_file"/>
              </group>
              <group>
                <attribute name="file"/>
                <attribute name="to_directory"/>
              </group>
              <group>
                <attribute name="to_directory"/>
                <ref name="fileset"/>
              </group>
            </choice>
          <optional>
            <attribute name="force">
              <!-- runtime evaluation
              <choice>
                <value>true</value>
                <value>false</value>
              </choice>
              -->
            </attribute>
          </optional>
        </element>
      </define>

## Examples

      <copy file="readme.txt" to_file="readme1.txt"/>

      <copy file="readme.txt" to_directory="/tmp"/>

      <copy to_directory="/tmp">
        <fileset directory="kernel" include="@(**/*.ge)"/>
      </copy>