# Clean-Up Removes files and folders from the FileSystem. ## Syntax ```{code-block} PowerShell :linenos: Clean-Up [-Directory ] [-Files] [] ``` ## Parameters | Type | Name | Description | Optional | | ------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | | String | Directory | Directory that should be removed. | yes | | String / [FileInfo] / {doc}`powerVault File ` | Files | The files that will be removed.When passing powerVault file objects they have to be downloaded via {doc}`Get-VaultFile -Download ` or {doc}`Save-VaultFile `. | yes | ## Return type **empty** \<- On failure the Exception/ErrorMessage can be accessed using [\$Error][$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** ```PowerShell $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** ```{code-block} PowerShell :linenos: $downloadedFiles =Save-VaultFile -File '$/Designs/Sample/Test.iam' -DownloadDirectory "C:\temp\Vault\Sample\" Clean-Up -files $downloadedFiles ``` **Removing a whole directory** ```{code-block} PowerShell :linenos: $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\' ``` [$error]: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-5.1#error [fileinfo]: https://docs.microsoft.com/en-us/dotnet/api/system.io.fileinfo