FP_SD_DELETE_DIR_WITH_FILES

Delete directory including files on SD card

This FP instruction deletes the directory including all files on the SD card specified by s1_FullDirName.

Parameters

Input

s1_FullDirName (STRING[32])

Directory name: specifies the name of the directory.

Remarks

  • The SD memory access active flag (sys_bIsSDMemoryAccessActive) turns to TRUE after the trigger EN of the SD card instruction has turned to TRUE and remains TRUE until execution has completed. During this time, other SD card instructions cannot be executed.

  • An error occurs when the directory to be deleted does not exist.

  • An error occurs when the specified folder contains a subfolder.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		sFullDirName: STRING[32]:='Logs';
		bEnable: BOOL:=FALSE;
	END_VAR

POU body

When the variable bEnable is set to TRUE, the function is executed. It deletes the folder 'Logs' from the root directory including all files of the SD card.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_CONTACT,,bEnable,4,1,6,3,);
B(B_F,FP_SD_DELETE_DIR_WITH_FILES!,,14,0,30,4,,?DEN?Ds1_FullDirName?AENO);
B(B_VARIN,,sFullDirName,12,2,14,4,);
L(1,0,1,4);
L(1,2,4,2);
L(6,2,14,2);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bEnable) then
    FP_SD_DELETE_DIR_WITH_FILES('\Logs');
END_IF;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline