LassoScript Utility
Basics Browse Detail

[File_Rename]

Tag Link [File_Rename] Category File
Type Process Source Available No
Support Preferred Version 3.0
Change Unchanged Data Source Any
Output Type None Security Tag, File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x

Description

[File_Rename] renames a file or directory. Accepts two parameters, the location of the file or directory to be modified and the location and new name for the file. Optional -FileOverWrite keyword specifies that the destination file should be overwritten if it exists.

The file tags are protected by four different permissions. The user must have permission for all of the following in order to use this tag:
- Permission to use the tag itself.
- Permission to perform the file operation.
- Permission to work in the directory which contains the files.
- The filename extensions of the files which are being worked with must be allowed in Lasso Administration.

Syntax

[File_RenameFile NameDestination File Name]

[File_RenameFile NameDestination File Name-FileOverWrite]

Parameters

Required Parameters
File Name The name of the file to be renamed.
Destination File Name The new name for the file.
Optional Parameters
-FileOverwrite If set the destination file will be overwritten if it exists.

Examples

To rename a file:

Use the [File_Rename] tag. The following example renames a file named myfile.txt to thefile.txt.

<?LassoScript
    File_Rename: '/myfile.txt', '/thefile.txt';
    Output: (File_CurrentError: -ErrorCode) + ': ' + (File_CurrentError);
?>

0: No Error