cffile action = "move"

Description

Moves a file from one location on the server to another.

Category

File management tags

Syntax

<cffile action = "move"
  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 move.
destination
Required. The full pathname of the directory or full pathname of the file to which the file will be moved. If you do not specify the filename, a trailing slash must be included in the target when moving a file. 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 moved. 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.

Example

The following example moves the keymemo.doc file from the c:\files\upload\ directory to the c:\files\memo\ directory on Windows:

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

Note

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 "memo. "