How to place created PDFs in a different Vault folder

To change where the generated PDF files are stored, change the path used by the 'Add-VaultFile' commandlet:

$customFolder = "$/customFolder/"
if($customFolder -notlike '*/'){
$customFolder += '/'
}
$vaultPDFfileLocation = "{0}.pdf" -f ($customFolder + [System.IO.Path]::GetFileNameWithoutExtension($file._name))
$PDFfile = Add-VaultFile -From $localPDFfileLocation -To $vaultPDFfileLocation -FileClassification DesignVisualization
Text
  • Specify a custom output folder
  • Check whether the folder name ends with a " / " or not. In case there is no " / "at the end, append it
  • Join the new base path and the filename
  • Use the combined path as the '-To' parameter when you are calling the 'Add-VaultFile' commandlet

Remarks

  • This example removes the previous file extension. If you want to append to the file extension use $file._name instead of [System.IO.Path]::GetFileNameWithoutExtension($file._name)