IPWorks Cloud 2020 C++ Edition

Questions / Feedback?

RenameFolder Method

Renames a folder.

Syntax

ANSI (Cross Platform)
int RenameFolder(const char* lpszFolderName, const char* lpszNewName);

Unicode (Windows)
INT RenameFolder(LPCWSTR lpszFolderName, LPCWSTR lpszNewName);
- (void)renameFolder:(NSString*)folderName :(NSString*)newName;
#define MID_WASABI_RENAMEFOLDER 29

IPWORKSCLOUD_EXTERNAL int IPWORKSCLOUD_CALL IPWorksCloud_Wasabi_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method renames the folder named FolderName to the name NewName. If NewName is already in use by existing folders, it will be overwritten if the current bucket has versioning enabled, or if the OverwriteOnRename configuration setting is set to true (default).

Since "folders" are in fact just name prefixes formatted to mimic a traditional file system, this method can rename multiple levels of "folders" at once by renaming a prefix. For example, assume you have the following objects in a bucket:

  • /pictures/animals/cats/cat1.jpg
  • /pictures/animals/cats/cat2.jpg
  • /pictures/animals/cats/cat3.jpg
  • /pictures/animals/cats/cat4.jpg
  • /pictures/animals/dogs/dog4.jpg
  • /pictures/animals/dogs/dog5.jpg

Doing the following command would leave you with the following objects in the bucket:
wasabi.RenameFolder("/pictures/animals/cats/", "pictures/pets/dogs");

  • /pictures/pets/dogs/cat1.jpg
  • /pictures/pets/dogs/cat2.jpg
  • /pictures/pets/dogs/cat3.jpg
  • /pictures/pets/dogs/cat4.jpg
  • /pictures/pets/dogs/dog4.jpg
  • /pictures/pets/dogs/dog5.jpg

And doing this command instead would leave you with these objects in the bucket, since the prefix being renamed now includes part of the "filename", and since (by default) the original "dog4.jpg" will get overwritten when "cat4.jpg" is renamed:
wasabi.RenameFolder("/pictures/animals/cats/cat", "pictures/pets/dogs/dog");

  • /pictures/pets/dogs/dog1.jpg
  • /pictures/pets/dogs/dog2.jpg
  • /pictures/pets/dogs/dog3.jpg
  • /pictures/pets/dogs/dog4.jpg
  • /pictures/pets/dogs/dog5.jpg

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) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 C++ Edition - Version 20.0 [Build 8265]