I can give you few suggestions on the PowerShell script for copying a folder. For the start, get ISHRemote library from the Powershell Gallery site.
Then you will need two functions, one for downloading content from the source location to a local drive and the second one for uploading content to the target site
- Download
o Get source folder recursively, e.g. $sourceFolderTree = Get-IshFolder -IshSession $ishSession -FolderPath $ishFolderPath –Recurse
o Loop over folders foreach($sourceFolder in $sourceFolderTree)
o Get folder path for each folder and make local path out of it $sourceFolderPath = Get-IshFolderLocation -IshSession $ishSession -FolderId $sourceFolder.IshFolderRef
o Get folder metadata and save it to a Xml file(if needed) $ishSession.Folder25.GetMetadataByIshFolderRef
o Get logical objects from the current folder: $folderLogicalObjects = Get-IshFolderContent -IshSession $ishSession -FolderId $sourceFolder.IshFolderRef
o Then you need to distinguish whether it is DocumentObj folder("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHIllustration", "ISHTEMPLATE") or Publication folder ("ISHPublication")
o For DocumentObj folder you need to get a list of language objects $folderLanguageObjects = Get-IshDocumentObj -IshSession $ishSession -LogicalId $logicalIds -RequestedMetadata $requestedMetadata then you can get data object using $folderObjectDataPath = Get-IshDocumentObjData -IshSession $ishSession -IshObject $folderLanguageObject -FolderPath $folderPathOnDisk
o For Publication folder you can use the following cmd-let to get output: Get-IshPublicationOutput. Then you will also need a baseline object and save it to a file ($ishSession.Baseline25.GetBaseline)
- Upload
o For upload you will need to create with the script every target folder based on the folder on your local disk (Add-IshFolder)
o For DocumentObj, Sort files by version, add objects using the Add-IshDocumentObj cmd-let (for images you will need to provide resolutions)
o For Publication objects you will need to do again sorting by version, add PublicationOutput as well as baseline and baseline items with commands Add-IshBaseline, Set-IshBaselineItem, Add-IshPublicationOutput
It is much easier if you skip PublicationOutput and Baseline objects. Also remember that this will not copy system LOVs, so Author, Language and others – they need to be created separately (manually)
I can give you few suggestions on the PowerShell script for copying a folder. For the start, get ISHRemote library from the Powershell Gallery site.
Then you will need two functions, one for downloading content from the source location to a local drive and the second one for uploading content to the target site
- Download
o Get source folder recursively, e.g. $sourceFolderTree = Get-IshFolder -IshSession $ishSession -FolderPath $ishFolderPath –Recurse
o Loop over folders foreach($sourceFolder in $sourceFolderTree)
o Get folder path for each folder and make local path out of it $sourceFolderPath = Get-IshFolderLocation -IshSession $ishSession -FolderId $sourceFolder.IshFolderRef
o Get folder metadata and save it to a Xml file(if needed) $ishSession.Folder25.GetMetadataByIshFolderRef
o Get logical objects from the current folder: $folderLogicalObjects = Get-IshFolderContent -IshSession $ishSession -FolderId $sourceFolder.IshFolderRef
o Then you need to distinguish whether it is DocumentObj folder("ISHModule", "ISHMasterDoc", "ISHLibrary", "ISHIllustration", "ISHTEMPLATE") or Publication folder ("ISHPublication")
o For DocumentObj folder you need to get a list of language objects $folderLanguageObjects = Get-IshDocumentObj -IshSession $ishSession -LogicalId $logicalIds -RequestedMetadata $requestedMetadata then you can get data object using $folderObjectDataPath = Get-IshDocumentObjData -IshSession $ishSession -IshObject $folderLanguageObject -FolderPath $folderPathOnDisk
o For Publication folder you can use the following cmd-let to get output: Get-IshPublicationOutput. Then you will also need a baseline object and save it to a file ($ishSession.Baseline25.GetBaseline)
- Upload
o For upload you will need to create with the script every target folder based on the folder on your local disk (Add-IshFolder)
o For DocumentObj, Sort files by version, add objects using the Add-IshDocumentObj cmd-let (for images you will need to provide resolutions)
o For Publication objects you will need to do again sorting by version, add PublicationOutput as well as baseline and baseline items with commands Add-IshBaseline, Set-IshBaselineItem, Add-IshPublicationOutput
It is much easier if you skip PublicationOutput and Baseline objects. Also remember that this will not copy system LOVs, so Author, Language and others – they need to be created separately (manually)