FP_SD_DELETE_DIR

Delete directory on SD card

This FP instruction deletes the directory on the SD card specified by s1_FullDirName. If there are still files in the directory, use the instruction FP_SD_DELETE_DIR_WITH_FILES.

Parameters

Input

s1_FullDirName (STRING)

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 directory is not empty. Check the contents of the directory.

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
		bStart: BOOL:=FALSE;
			(*activates the instruction*)
	END_VAR

POU body

When the variable bStart changes from FALSE to TRUE and the system variable sys_bIsSDMemoryAccessActive is not TRUE, the function is carried out. It deletes the folder 'Test' from the root directory of the SD card.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_VARIN,,'\Test\',21,2,23,4,);
B(B_CONTACT,,bStart,3,1,5,3,R);
B(B_CONTACT,,sys_bIsSDMemoryAccessActive,11,1,13,3,N);
B(B_F,FP_SD_DELETE_DIR!,,23,0,33,4,,?DEN?Ds1_FullDirName?AENO);
L(1,2,3,2);
L(5,2,11,2);
L(13,2,23,2);
L(1,0,1,4);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF DF(bStart)AND not sys_bIsSDMemoryAccessActive then
    FP_SD_DELETE_DIR('\Test');
END_IF;

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