CleanUnusedRepoFiles

<< Click to Display Table of Contents >>

CleanUnusedRepoFiles

Identifies files in the PDQ Deploy repository that are no longer referenced by any package, then optionally deletes them to free disk space. This is the command line equivalent of Options > Repository Cleanup in the console.

Orphaned files can accumulate when packages are deleted, auto-downloaded packages are replaced by newer versions, or package steps are edited to reference different files. Running this command periodically helps keep repository disk usage under control.

Syntax

PDQDeploy CleanUnusedRepoFiles [-Force] [-WhatIf]

Parameters

Parameter

Required

Description

-Force

No

Skips the [y/N] confirmation prompt and deletes unused files immediately. Use this flag for automated scheduled tasks where no interactive input is available.

-WhatIf

No

Lists the unused files and total space that would be freed, but does not delete anything. Use this to preview the cleanup before committing.

Exit Codes

Exit Code

Meaning

0

Command completed successfully. Files were deleted, or -WhatIf was specified (no deletion performed).

1

Cleanup failed or partially failed. One or more files could not be deleted.

2

User cancelled at the confirmation prompt.

3

No unused files were found. Nothing to clean up.

Examples

Preview which files would be deleted without deleting anything:

PDQDeploy CleanUnusedRepoFiles -WhatIf

Run interactively with a confirmation prompt:

PDQDeploy CleanUnusedRepoFiles

Run silently for use in a scheduled task:

PDQDeploy CleanUnusedRepoFiles -Force

Check the exit code in a PowerShell script:

PDQDeploy CleanUnusedRepoFiles -Force

if ($LASTEXITCODE -eq 0) {

 Write-Host "Repository cleaned successfully."

} elseif ($LASTEXITCODE -eq 3) {

 Write-Host "No unused files found."

} else {

 Write-Warning "Cleanup failed with exit code $LASTEXITCODE"

}

NOTE: Repository cleanup exclusions configured in the console (Options > Repository Cleanup > Exclusions) are respected by this command.

 

 

 

© 2026 PDQ.com Corporation. All rights reserved.

PDQ.com is a trademark of PDQ.com Corporation. All other product and company names are the property of their respective owners.

Help Version: 20.0.22.0