Discuss this help topic in SecureBlackbox Forum

Clouds: Copy and move folders

To move a folder use TElBoxFolder.Move() method of the folder object, which you want to move. Pass the object that identifies a destination folder as the parameter.

C#:


// get an object for the target folder
TElBoxFolder targetFolder = storage.AcquireFolder(@...);
Console.WriteLine("Target folder: {0} (id = {1})",
	targetFolder.Name, targetFolder.ID);

// get an object for the folder to be moved
TElBoxFolder folder = storage.AcquireFolder(@"...");
Console.WriteLine("Folder: {0} (parent = {1})", folder.Name, folder.ParentID);

// actually, move the folder to the target folder
nonEmptyFolder.Move(targetFolder);
Console.WriteLine("Moved: {0} (parent = {1})", folder.Name, folder.ParentID);

// don't forget to release the objects
folder.Release();
targetFolder.Release();

To copy a folder use TElBoxFolder.Copy() method of the folder object, which you want to copy. Pass the object that identifies destination folder as the parameter. Optionally you can specify the new name of the folder being copied. The method returns the object, that corresponds to the newly created folder.

C#:


// get an object for the target folder
TElBoxFolder targetFolder = storage.AcquireFolder(@...);
Console.WriteLine("Target folder: {0} (id = {1})",
                  targetFolder.Name, targetFolder.ID);

// get an object for the folder to be copied
TElBoxFolder folder = storage.AcquireFolder(@"...");
Console.WriteLine("Folder: {0} (parent = {1})", folder.Name, folder.ParentID);

// actually, copy the folder to the target folder
TElBoxFolder copiedFolder = folder.Copy(targetFolder, "Copied Folder");
Console.WriteLine("Copied: {0} (parent = {1})",
                  copiedFolder.Name, copiedFolder.ParentID);

// don't forget to release the objects
folder.Release();
copiedFolder.Release();
targetFolder.Release();

How To articles about Box.com cloud

Discuss this help topic in SecureBlackbox Forum