1.2.7.4.33 SYS_FS_FileDirectoryRemove Function

C

SYS_FS_RESULT SYS_FS_FileDirectoryRemove
(
    const char* path
);

Summary

Removes a file or directory.

Description

This function removes a file or directory as specified by the path.

Precondition

  • The disk has to be mounted before a directory could be removed.

  • The file or directory to be removed has to present.

  • The file/sub-directory must not have read-only attribute (AM_RDO), or the function will be rejected with FR_DENIED.

  • The sub-directory must be empty and must not be current directory, or the function will be rejected with FR_DENIED.

  • The file/sub-directory must not be opened.

Parameters

ParamDescription
pathPath of the File or directory to be removed.

Returns

SYS_FS_RES_SUCCESS - Indicates that the file or directory remove operation was successful.

SYS_FS_RES_FAILURE - Indicates that the file or directory remove operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error.

Example

SYS_FS_RESULT res;

res = SYS_FS_FileDirectoryRemove("Dir1");

if(res == SYS_FS_RES_FAILURE)
{
    // Directory remove operation failed
}

Remarks

None.