Removes files and folders from the FileSystem.

Clean-Up [-Directory <string>] [-Files<object>] [<CommonParameters>]

Type Name Description Optional
String DirectoryDirectory that should be removedyes
String / FileInfo / powerVault File Files The files that will be removed.
When passing powerVault file objects they have to be downloaded via Get-VaultFile -Download or Save-VaultFile

empty ← On failure the Exception/ErrorMessage can be accessed using $Error.

When passing folders or files that does not exist, the cmdlet will not inform you or stop executing.
By passing only a directory path all the files in that folder are getting removed. The empty directories are getting removed too.
When passing files, they and the empty folders will be deleted.
When passing a directory and files to the cmdlet, the cmdlet removes all the passed files and empty directories.

Removing a file that was downloaded with Get-VaultFile

$file = Get-VaultFile -File '$/Designs/Test.ipt' -Download 'C:\Temp\Pad Lock'
Clean-Up -files @($file)

Removing a list of files that where downloaded with Save-VaultFile

$downloadedFiles =Save-VaultFile -File '$/Designs/Sample/Test.iam' -DownloadDirectory "C:\temp\Vault\Sample\"
Clean-Up -files $downloadedFiles 

Removing a whole directory

$file = Get-VaultFile -File '$/Designs/Test.ipt' -Download 'C:\temp\Vault\'
$downloadedFiles = Save-VaultFile -File '$/Designs/Sample/Test.iam' -DownloadDirectory "C:\temp\Vault\Sample\"
Clean-Up 'C:\temp\Vault\'