This Python script is designed to clean up shader cache files from known locations on a Windows 11 machine. Shader cache files are temporary files generated by graphics drivers and game engines to improve performance by caching shader data.
-
Recursive Directory Cleaning: The script now checks for shader caches not only in the specified directories but also in any nested subdirectories, ensuring comprehensive cleanup of shader cache files.
-
Backup Option: When running the script, you now have the option to create backups of directories containing shader cache files before they are deleted. This allows for recovery if needed.
-
Dry Run Mode: You can execute the script in dry run mode, which simulates the cleanup process without actually deleting any files. This feature is useful for reviewing what would be removed without making any changes.
-
Enhanced Logging: The script provides detailed logging, which includes information about directories found, files deleted, and actions taken, making it easier to track the process.
-
Clone the Repository: Clone or download this repository to your local machine.
-
Ensure Python is Installed: Ensure you have Python installed on your system. You can download it from the official Python website.
-
Run the Script:
- Open Command Prompt as an administrator.
- Navigate to the directory where the script (
remove_shader_cache.py
) is saved using thecd
command. - Run the script by typing:
- To perform a cleanup:
python remove_shader_cache.py
- To run in dry-run mode (no files will be deleted):
python remove_shader_cache.py --dry-run
- To create backups before deletion:
python remove_shader_cache.py --backup
- To run both dry-run and backup:
python remove_shader_cache.py --dry-run --backup
- To perform a cleanup:
-
Review Output: The script will delete shader cache files from various known locations on your system. Review the Command Prompt window output to ensure all cache files were removed successfully.
The script removes shader cache files from the following known locations:
- NVIDIA DXCache
- NVIDIA GLCache
- AMD DxCache
- Unreal Engine ShaderCache
- Unity Caches
- DirectX Shader Cache
- NVIDIA Temp Cache
- DirectX Temp Cache
- DirectX Shader Temp Cache
- AMD Temp GL Cache
- Unreal Engine Derived Data Cache
- Unity Asset Store Cache
- .NET CLR Cache
- Additional NVIDIA NV_Cache Locations
- Running this script will permanently delete files in the specified directories. Ensure you understand the impact of this action, especially if you're running it on a system where the shader cache might be needed.
- Run the script with administrative privileges to ensure all cache files can be deleted.
- Be cautious when using the --backup option; ensure you have enough disk space for the backups.