I'm trying to build a script to export files to a local drive. I've been able to use the Export-PWDocuments and I get the files and folders. However, I don't want the whole parent path. I only want from a certain child level where I'm searching for files and the associated subfolders. Is there a way to perform this? Below is a sample of what I would like
$PWServer = "Testing.projectwiseonline.com:"$PWDataSource = "Testing"
$OutputPath = "C:\Destination\XYZ"$SourcePath = "\Organization\Unit\XYZ"
New-PWLogin -DatasourceName $PWServer$PWDataSource -BentleyIMS
$outDocs = Get-PWDocumentsBySearch -FolderIPath $SourcePath Write-Host "Starting the export process" -f Yellow
Export-PWDocuments -InputDocuments $outDocs -OutputFolder $OutputPath
Undo-PWLogin
The results are that I get in the $OutputPath C:\Destination\xyz\Organization\Unit\xyz
What I would like to have when done is C:\Destination\XYZ
The Export-PWDocuments Cmdlet doesn't allow for specifying a specific target folder. As the documentation states, "Folder structure is preserved..."
What you could do is move the files to the desired directory after the export with the PowerShell Cmdlete "Move-Item".
Answer Verified By: Franklin Henderson-C
Thanks Dan. That's what I thought. But wanted to ensure that I was not missing anything.