How To The Write `<cffile action=”rename”>` Function In ColdFusion?
Description:-
Renames or moves a file on the server.
<cffile
action = "rename"
destination = "pathname"
source = "full pathname"
attributes = "file attributes list"
mode = "mode"
>
cfscript the equivalent of the upper syntax
<cfscript>
cffile(
action = "rename",
destination = "pathname",
source = "full pathname",
attributes = "file attributes list",
mode = "mode"
);
</cfscript>
Attributes:-
action:- This is a required attribute, the type of file manipulation that the tag performs.
destination:- This is a required attribute, the Pathname of a directory or file on the web server where the file is moved.
source:- This is a required attribute and the pathname of the file to rename. If it is not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function.
attributes:- This is a non-required attribute, A comma-delimited list of attributes to set on the file that applies to Windows. the values are:-readOnlyhiddennormal
mode:- This is a non-required attribute and applies only to UNIX and Linux. Permissions. Octal values of UNIX chmod command. Assigned to owner, group, and other, respectively.644:- assigns read/write permission to the owner; read permission to group and others.777:- assigns read/write/execute permission to all.
Example:-
This example renames and moves the testNote.txt file from d:\files\documents\ to the d:\files\documents\textNote\ directory in Windows.
<cffile
action = "rename"
source = "d:\files\documents\testNote.txt"
destination = "d:\files\documents\textNote\newNote.txt"
attributes = "normal"
>
