FC_RenameFile - General Information

Overview

Type:

Function

Available as of:

SystemInterface_1.32.6.0

Versions:

Current version

Task

Rename file.

Description

The file named i_sOldFilename is renamed i_sNewFilename. You can rename files on the following devices:

  • ide0:

  • ram0:

You cannot modify file names on RemoteDevices.

The default device is "ide0:".

You must specify the device name, except the default device name, in i_sOldFilename. Separate the device name and the file name by a backslash "\".

You must specify the folder name in the file name of i_sOldFilename. There is no folder name for the root directory. The file is not copied or moved.

If you try to rename a system file that is not editable with this function, then you get -5 as the return value (see below). The system file is not renamed.

Also refer to controller-specific system files and general system files.

The function FC_RenameFile() returns 0 as result if the process was successful. If an error is detected, the renaming operation was not successful. The file still has its old file name. i_sOldFilename and i_sNewFilename do not permit any wildcards. The duration of the process depends on the data memory used. When using a CompactFlash, runtime is typically some 10 ms.

Interface

Input

Data type

Description

i_sOldFilename

STRING[80]

Name of the file that has to be renamed

i_sNewFilename

STRING[80]

New file name

Return Value

Data type

Description

DINT

0: File renamed

-1: The file that has to be renamed does not exist.

-2: A file with the desired name already exists.

-3: A folder was specified in i_sNewFilename.

-4: Wildcard in i_sOldFilename and/or i_sNewFilename.

-5: You are trying to rename a system file.

Examples

FC_RenameFile('ide0:\test.txt','seriel.txt');  

The "test.txt" file on device "ide0:" is renamed as the "seriel.txt" file on device "ide0:".


FC_RenameFile('test.txt','seriel.txt');  

The "test.txt" file on device "ide0:" is renamed as the "seriel.txt" file on device "ide0:".


FC_RenameFile('t*.txt','s*.txt');  

Return -4: => wildcard in "sOldFilename" and "sNewFilename".


FC_RenameFile('Max4.out','test.out');  

Error => Cannot rename the "Max4.out" system file.