DeleteFile Method

Deletes a vault item.

Syntax

ANSI (Cross Platform)
int DeleteFile(const char* lpszFileName);

Unicode (Windows)
INT DeleteFile(LPCWSTR lpszFileName);
- (void)deleteFile:(NSString*)fileName;
#define MID_CBVAULT_DELETEFILE 13

CBFSSTORAGE_EXTERNAL int CBFSSTORAGE_CALL CBFSStorage_CBVault_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method deletes the vault item (file, directory, symbolic link, or alternate stream) specified by FileName from the vault.

The value passed for FileName must be a vault-local absolute path.

Please note that:

  • When a file is deleted, any alternate streams it contains are deleted as well.
  • Directories must be empty to be deleted, otherwise this method fails with an error. Use the IsDirectoryEmpty method to check whether a directory is empty.
  • Deleting a symbolic link only deletes the link itself, not the file it points to.

Note: This method can only be called when Active is true, and cannot be called within events.

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Storage 2020 C++ Edition - Version 20.0 [Build 8031]