ePass1000 C/C++ API Reference Manual Version 2.0

epas_DeleteDir

The epas_DeleteDir function permanently erase a directory and files in the current directory. And it is impossible to recover the removed directory or files.

EPAS_STATUS EPAS_API
epas_DeleteDir(
    EPAS_HANDLE hContextHandle,      // [in]
    unsigned long ulFlags,           // [in]
    unsigned long ulDirID,           // [in]
    unsigned char* pucName           // [in]
);

Requirement

epas_CreateContext, epas_OpenDevice

Parameters

hContextHandle
[in] Handle to device context.
ulFlags
[in] This parameter is a bit mask value that defines the options for directory deletion. You may use OR operation to enable one or more option:
Flag Meaning
0 Delete the directory specified by the ulDirID parameter. The pucName parameter is ignored and should be set to NULL.
EPAS_DIR_BY_ID Delete the directory specified by the ulDirID parameter. If directory ID that given by ulDirID is not a 16-bit ID, invoking will fail.
EPAS_DIR_BY_LONG_ID Delete the directory specified by the ulDirID parameter.
EPAS_DIR_BY_NAME When this flag is set, the pucName parameter points to a NULL terminated string defining the Application Directory Name to delete.
EPAS_DIR_BY_GUID When this flag is set, the pucName parameter points to an array of 16 bytes defining the Application Directory GUID to delete.
EPAS_DIR_BY_GUID_STR When this flag is set, the pucName parameter points to an array of NULL terminate string defining the Application Directory GUID string to delete.
ulDirID
[in] The directory Id to be deleted. This parameter is only valid when directory 's Name or GUID are not specified.
pucName
[in] Pointer to a buffer that defines the Application Directory name or GUID to delete as defined by the ulFlags parameter.

Remarks

To format the whole file system, set the directory ID to EPAS_ROOT_DIR and EPAS_DIR_BY_ID flag. This operation requires SO PIN authorization.

For a list of reserved directory IDs, see EPAS_DIRINFO.

Return Values

If the function succeeds, FT_SUCCESS returned.

If the directory deletion access to the file has not granted, FT_ACCESS_DENIED returned.

If the specified directory does not exist, FT_DIR_NOT_FOUND returned.

For a list of all return codes, see Status Return Values.

Sample Code

EPAS_STATUS epsRet;
EPAS_HANDLE handle;
epsRet = epas_DeleteDir(handle,EPAS_DELETE_RECURSIVE | EPAS_DIR_BY_GUID,
                        0,(unsigned char*)&guid);
.
.
.

See Also

epas_CreateFile, epas_DeleteFile, epas_OpenFile, epas_CloseFile, epas_GetFileInfo, epas_Read, epas_Write, epas_CreateDir, epas_GetCurrentDir, epas_ChangeDir, epas_Directory