COPY

Action

Copies one or more files or directories.

 

Syntax

COPY "source" "destination" [/h] [/s]

 

If the source or destination specifies a directory, please make sure to add a trailing backslash.

 

/c

Continue operation, even if errors occur.

/h

Copies hidden and system files also.

/r

Overwrite read-only files.

/s

Copies directories and subdirectories, including empty ones.

 

 

Remarks

Wildcards are supported.

If a file already exists at the destination, it is overwritten without warning.

 

Examples

; The following examples copy all files in MyDir to NewDir

COPY "S:\MyDir\*.*" "S:\NewDir\*.*"

COPY "S:\MyDir\." "S:\NewDir\."

COPY "S:\MyDir\" "S:\NewDir\"

 

; If the target (directory) does not exist, and the target specification ; does not have a trailing backslash, COPY will fail with

; errorcode 3 ("path not found")

COPY "S:\MyDir\" "S:\NewDir"     ; fails if NewDir does not exist

 

; This command will copy all files that match the wildcard specification

; and change their extension to '.bak'

COPY "MyDir\file*.txt" "MyDir\file*.bak"