cffile action = "copy"

Description

Copies a file from one directory to another on the server.

Category

File management tags

Syntax

<cffile action = "copy"
  source = "full_path_name"
  destination = "full_path_name"
  attributes = "file_attributes"> 

See also

cfdirectory

Attributes

Attribute
Description
source
Required. The full pathname of the file to copy.
destination
Required. The full pathname of the directory or full pathname of the file where the copy of the file is saved. If you do not specify a filename, you must include the trailing slash. Use the backward slash (\) on Windows; use the forward slash (/) on UNIX.
attributes
Optional. A comma-delimited list of file attributes to be set on the file being renamed. The following file attributes are supported:
  • readOnly
  • temporary
  • archive
  • hidden
  • system
  • normal
If attributes is not used, the file's attributes are maintained. If normal is specified with any other attributes, normal is overridden by whatever other attribute is specified.
Individual attributes must be specified explicitly. For example, if you specify only the readOnly attribute, all other existing attributes are overwritten.

Usage

On Windows, you must include the backward slash (\) after the destination directory name if you do not specify a filename. In this example, the specified destination directory is "backup."

Example

The following example saves a copy of the keymemo.doc file in the c:\files\backup\ directory:

<cffile action = "copy" 
  source = "c:\files\upload\keymemo.doc" 
  destination = "c:\files\backup\">