MoveFile Method

Renames or moves a vault item.

Syntax

ANSI (Cross Platform)
int MoveFile(const char* lpszOldFileName, const char* lpszNewFileName, int bOverwrite);

Unicode (Windows)
INT MoveFile(LPCWSTR lpszOldFileName, LPCWSTR lpszNewFileName, BOOL bOverwrite);
- (void)moveFile:(NSString*)oldFileName :(NSString*)newFileName :(BOOL)overwrite;
#define MID_CBDRIVE_MOVEFILE 64

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

Remarks

This method renames or moves a vault item (file, directory, symbolic link, or alternate stream) from the specified OldFileName to the specified NewFileName. For alternate streams, renaming is always possible, but moving them from one file to another is only allowed if the AllowMoveStreamsBetweenFiles configuration setting is enabled.

The values passed for OldFileName and NewFileName must both be vault-local absolute paths (including the item's old and new names, respectively) in the same vault.

The Overwrite parameter specifies what to do if a vault item with the specified NewFileName already exists. If Overwrite is true, and such an item exists, it will be overwritten by the item specified by OldFileName. But if such an item exists, and Overwrite is false, this method fails with an error.

Please note that the usual rules of deletion still apply for an item being overwritten. Notably, a non-empty directory cannot be overwritten.

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]