Clean-Up

Removes files and folders from the FileSystem.

Syntax

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

Parameters

Type

Name

Description

Optional

String

Directory

Directory that should be removed.

yes

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.

yes

Return type

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

Remarks

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.

Examples

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

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

Removing a whole directory

1
2
3
$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\'