CloudStoreObject[ ] children = sendListDirectoryContentsRequest(
fromDirectory,
CloudStoreObjectType.OBJECT,
true );
CloudStorePath newDirPath = toDirectory.getPath( )
.combine(
PathUtil.popLeaf( fromDirectory.getPath( ) ) );
CloudStoreObjectMetadata newMetadata = fromDirectory.getMetadata( );
if ( toDirectory.hasDirtyMetadata( ) )
{
// user has written meta-data to the target object,
// implying that meta-data should be overwritten.
newMetadata = toDirectory.getDirtyMetadata( );
}
sendIntraStoreCopyRequest( fromDirectory.getPath( ), newDirPath,
newMetadata );
for ( CloudStoreObject child : children )
{
CloudStorePath newPath = PathUtil
.replace( child.getPath( ),
fromDirectory.getPath( ), newDirPath );
sendIntraStoreCopyRequest( child.getPath( ), newPath, child
.getMetadata( ) );
}