<# .SYNOPSIS Given the CSV output from the Project export function, copy CatalogResources to a new location. .DESCRIPTION The Project export function can be used to produce a CSV report of all Resources associated with a Project. This script takes that CSV report as an input, and copies files from the CatalogResources folder into a new location. .EXAMPLE powershell.exe -f project-export-script.ps1 -catalogResources "E:\CatalogResources" -inputFile "C:\Downloads\my-csv-file.csv" -outputPath "\\backup-location\CatalogResources" .PARAMETER catalogResources The full filepath of the folder used as the CatalogResources location for Centro WebApp. .PARAMETER inputFile The full filepath of the CSV report. .PARAMETER outputPath The full filepath of the folder where files will be copied. Unless you set useCatalogIdAsFolderName, the existing directory structure within the CatalogResources folder is preserved. .PARAMETER useCatalogIdAsFolderName Set true if you want to create folders using Catalog IDs/Resource names for folders, instead of copying the CatalogResources folder structure. #> param([string]$catalogResources = "", [string]$inputFile = "", [string]$outputPath = "", [bool]$useCatalogIdAsFolderName = $false) $resources = import-csv $inputFile | where-object { $_.Filepath -ne "" } foreach($res in $resources) { $outputFilePath = If ($useCatalogIdAsFolderName) { "$outputPath\\$($res.PartCatalogId)\\$($res.Name)\\$($res.Version)\\$($res.Filename)" } Else { "$outputPath\\$($res.Filepath)" } new-item -path $outputFilePath -type File -force copy-item "$catalogResources\$($res.Filepath)" $outputFilePath }