games:cleanup-downloads
Cleans up old game version downloads, keeping only the latest version to save storage space.
Overview
This command removes outdated game download files from storage while preserving the most recent version of each game. It helps manage disk space by removing files that are no longer needed for analysis or processing.
Key Features: Selective cleanup, storage optimization, safety checks, comprehensive logging.
Usage
Options
- --game-id=ID
ID of the specific game to clean up.
- --game-name=NAME
Name (or part of name) of the game(s) to clean up.
- --all
Clean up downloads for all games.
Cleanup Logic
The command follows this cleanup process:
Identifies game versions for the specified scope
Determines latest version for each game
Marks older versions for cleanup
Removes download files while preserving metadata
Updates database records to reflect cleanup status
Reports storage savings achieved
Examples
Cleans up old downloads for game ID 123, keeping only the latest version.
Cleans up downloads for all games with "Doki Doki" in the name.
Cleans up old downloads for all games in the database.
Shows detailed information about each file being removed.
When to Use
Recommended Usage Scenarios
Regular maintenance to manage storage space
Before storage capacity reaches limits
After bulk game imports or updates
When preparing for system backups
During server maintenance windows
Safety Features
The command includes several safety mechanisms:
Data Preservation
Metadata Retention: Database records remain intact
Latest Version Protection: Never removes the most recent version
Analysis Data: Preserves processed statistics and character data
Verification Checks
File Existence: Verifies files exist before attempting removal
Permission Checks: Ensures write access to storage directories
Database Consistency: Maintains referential integrity
Storage Impact
File Type | Typical Size | Cleanup Impact |
|---|---|---|
Game Archives | 50-500 MB | High storage savings |
Extracted Files | 100-1000 MB | Very high savings |
Processing Temp | 10-100 MB | Medium savings |
Metadata | < 1 MB | Preserved (not cleaned) |
Cleanup Scope
The command can target different scopes:
Single Game (--game-id)
Fastest execution
Precise control
Minimal system impact
Named Games (--game-name)
Pattern-based selection
Useful for series or collections
Moderate system impact
All Games (--all)
Maximum storage savings
Longest execution time
Highest system impact
Monitoring
During cleanup, monitor:
Storage space freed - Primary benefit metric
Files processed - Progress indicator
Errors encountered - File access issues
Database updates - Metadata consistency
Recovery
If files need to be restored after cleanup:
Re-download from original sources (if available)
Restore from backups (if backup strategy includes downloads)
Re-import using other commands if source files exist
Related Commands
games:refresh - Re-download game files
games:reimport-version - Reprocess existing files