Rename, Delete, or Copy RM File

See also: Removable Media in Advanced Ladder

See also: Project Toolbox for Advanced Ladder

 

Topic Menu

Rename RM File

This function allows renaming a file on the Removable Media card. The data in the file is not changed.

 

Note: This function allows renaming a file on the Removable Media card. The data in the file is not changed.

 

Old File Name - This is the original filename to rename. This can be a constant or a controller registers. If this is a constant it can be up to 147 characters long that includes sub directories (i.e. "my_data\test.csv"). If the filename is stored in registers it still has a limit of 147 characters and must be terminated with a NULL (byte containing zero). To indicate the file is in a register, place the percent (%) symbol before the register name. This is used to differentiate between "R1234" which is a valid file name and "%R1234" which is a register reference. File and directory names are limited to the 8.3 convention. This is 8 characters for the name and 3 characters for an extension with a period (.) separating them.

New File Name - This is the new filename. This can be a constant or a controller registers and has the same requirements as the old filename.

Status - This is a 16-bit controller registers used to show the status of the function block. See the possible status codes in the status section below.

Rung Power - This function passes power once the Status returns a 0, assuming power is still applied to the function. Should power be lost to the Rename function before it is finished, however, the function will still complete.

 

Return to the Top: Rename, Delete, or Copy RM File

Delete RM file

 

Note: This function allows deleting a file on the Removable Media card.

File Name - This is the filename to delete. This can be a constant or a controller registers. If this is a constant it can be up to 147 characters long that includes sub directories (i.e. "my_data\test.csv"). If the filename is stored in registers it still has a limit of 147 characters and must be terminated with a NULL (byte containing zero). To indicate the file is in a register, place the percent (%) symbol before the register name. This is used to differentiate between "R1234" which is a valid file name and "%R1234" which is a register reference. File and directory names are limited to the 8.3 convention. This is 8 characters for the name and 3 characters for an extension with a period (.) separating them.

Wildcard Support - In firmware version 12.60 onwards, if the filename string contains wildcard characters, all files that match the file specification will be deleted. Rules for wildcards are the same as in a DOS file system. A question mark (?) in the filename string matches any single character, while an asterisk (*) in the filename matches a string of characters in either the filename or the extension.

Examples:

  • If the specified filename string is \group1\*.csv, all files in the group1 folder that have a .csv extension will be deleted.

  • If the specified filename string is \group1\??????.csv, all files in the group1 folder that have 6-character filenames followed by a .csv extension will be deleted.

Exception: Files that are marked with the System attribute can’t be deleted via the Delete RM Function. Please note that all currently updating Datalog files have their System attribute set to prevent them from being deleted until they are complete.

Status - This is a 16-bit controller registers used to show the status of the function block. See the possible status codes in the status section below.

Rung Power - This function passes power once the Status returns a 0, assuming power is still applied to the function. Should power be lost to the Delete function before it is finished, however, the function will still complete.

 

Return to the Top: Rename, Delete, or Copy RM File

 

Copy RM File

 

Note: This function allows copying a file on the Removable Media card. The data in the file is not changed.

Source - This is the name of the file to be copied. This can be a constant or a controller registers. If this is a constant it can be up to 147 characters long that includes sub directories (i.e. "my_data\test.csv"). If the filename is stored in registers it still has a limit of 147 characters and must be terminated with a NULL (byte containing zero). To indicate the file is in a register, place the percent (%) symbol before the register name. This is used to differentiate between "R1234" which is a valid file name and "%R1234" which is a register reference. File and directory names are limited to the 8.3 convention. This is 8 characters for the name and 3 characters for an extension with a period (.) separating them. See the Removable Media Filenames section for more filename options.

Wildcard Support - In firmware version 12.60 onwards, if the source filename string contains wildcard characters (? or *), all files that match the file specification are copied. In this case, the destination filename string must not specify a file, but should just contain a path string indicating the folder to copy the files into. Rules for wildcards are the same as in a DOS file system. A question mark (?) in the filename string matches any single character, while an asterisk (*) in the filename matches a string of characters in either the filename or the extension.

Examples:

  • If the source filename string is \group1\*.csv and the destination filenames string is \save1, then all files in the group1 folder which have a .csv extension will be copied into the save1 folder.

  • If the source filename string is \group1\??????.csv and the destination filenames string is \save1, then all files in the group1 folder that have 6-character filenames followed by a .csv extension will be copied into the save1 folder.

Destination – This is the file which will be created containing the copied data. This can be a constant or a controller registers and has the same requirements as the old filename. When copying a file or files, if the destination path or file does not exist, it will be created. Also, if a destination file does exist before the copy, the file will be overwritten.

Status – This is a 16-bit controller registers used to show the status of the function block. See the possible status codes in the status section below. This is the target for storing location for new filename. This can be a constant or a controller registers and has the same requirements as the old filename.

Note: For satisfactory working of Copy Removable Media block, user must take care that not more than 2 MB of data is copied at a time.

 

Return to the Top: Rename, Delete, or Copy RM File