Cloud Storage Integrator 2016 .NET Edition
Cloud Storage Integrator 2016 .NET Edition
Questions / Feedback?

RenameFolder Method

Renames a folder.

Syntax

[VB.NET]
Public Sub RenameFolder(ByVal FolderName As String, ByVal NewName As String)
[C#]
public void RenameFolder(string folderName, string newName);

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

 
 
Copyright (c) 2019 /n software inc. - All rights reserved.
Cloud Storage Integrator 2016 .NET Edition - Version 16.0 [Build 7239]