Salesforce

How Do I Rename a File on Disk? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Rename a File on Disk? (Magic xpa 3.x)

Sometimes you need to be able to rename a disk file. For instance, you might want to rename the previous copy of a backup file before creating a new one.

It is always better to use the Magic xpa functions rather than using an exit to the operating system. Using an exit to the operating system is very dependent on the version of the operating system and how the user is set up; the Magic xpa functions are far more reliable. Also, the Magic xpa functions allow you to check return codes more easily.

FileRename()

You can rename a file on disk using the FileRename() function. The syntax is:

FileRename (origin, target)

Where origin is the original file name and target is what you want to rename it. It gives a return code of true if the file was successfully renamed.

We show two examples here. The first, on line 7, uses an Evaluate operation and fetches the return code in the Result field. The second, on line 10, uses an Update operation to accomplish the same thing. Either will work.

See also

The Magic xpa Help for I/O functions

The Online and Rich Client Samples projects (program EL19, REL19 and REL19b)

Reference
Attachment 
Attachment