Advertisement
Developer_Bastian

Clean Unreal Engine project and plugin directories

May 23rd, 2024
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Clean an Unreal Engine development directory
  2.  
  3. # Place into the root of your Unreal Project and execute between adding new files or pushing to Git
  4. # Make sure to edit the starter array to include all plugin directories you want to clean
  5.  
  6. $myPath = Get-Location
  7. Write-Host "Will delete tmp directories from: $myPath" -ForegroundColor Green
  8.  
  9. # Define an array of inventory directory names to delete
  10. $inventory = @('.vs', '.vsconfig', 'Binaries', 'DerivedDataCache'
  11. , 'Intermediate', 'Saved'
  12. , 'Plugins\BA_RepArray\Intermediate', 'Plugins\BA_RepArray\Binaries')
  13.  
  14. # Iterate over the array and delete each inventory directory if it exists
  15. foreach ($item in $inventory) {
  16.     if (Test-Path $item) {
  17.         Write-Host "Deleting directory '$item' with all subdirectories and files..." -ForegroundColor Green
  18.         Remove-Item $item -Recurse -Force
  19.     } else {
  20.         Write-Host "Directory '$item' does not exist." -ForegroundColor DarkYellow
  21.     }
  22. }
  23.  
  24. # delete sln file
  25. foreach ($file in Get-ChildItem -Filter "*.sln") {
  26.     Write-Host "Deleting Visual Studio solution file '$item'" -ForegroundColor Green
  27.     Remove-Item $file -Force
  28. }
  29.  
  30. # Add a pause at the end of the script
  31. Write-Host "Press Enter to exit script" -ForegroundColor White
  32. Read-Host
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement