Community Tutorial: Clean Project directory using batch File

In this tutorial, I’m gonna show you how you can create a simple batch file to clean your project (to reset it to bare bones) if something is messed up. In that way several bugs might be fixed. I personally using it when I move my project to another PC back and forth, because for some reason when I recompile it on the new machine I always get some errors.

https://dev.epicgames.com/community/learning/tutorials/l7rR/unreal-engine-clean-project-directory-using-batch-file

I see you’ve thought of VS and Rider as well. It’s not 100% a cleanup since you still got to think of plugin directories of which you may or may not want to clean. The best way to get the “clean” version of the project would still be by restoring through Git especially from pc to pc. Then your version control will certainly provide the same version as a cleaned version, since you’d never store unneccessary files in Git. For that I use not a blacklist but a whitelist gitignore. I’ve tested this for many months. Note that I use custom directories “_Documentation, SourceContent” here:

# First, ignore everything
*
# Now, whitelist anything that's a directory
!*/

# base files
!**/*.uproject
!**/*.uplugin
!**/.gitignore

# _Documentation, whitelist everything
!**/_Documentation/**
# Ignore OpenOffice temp files
**/_Documentation/**/.~lock.*

# Config
!Config/**
!Plugins/*/Config/**

# Content
!Content/**
!Plugins/*/Content/**
# Content Built data for maps
**/*_BuiltData.uasset

# Resources
!Plugins/*/Resources/**

# Source
!Source/**
!Plugins/*/Source/**

# Script
!Script/**
!Plugins/*/Script/**

# Configuration files generated by the Editor
!Saved/Config/Windows/*.ini
## Config consists mostly of shared files except per-user editor settings
# Saved/Config/**/DefaultEditorPerProjectUserSettings.ini

# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/PakBlacklist*.txt
# Don't ignore icon files in Build
!Build/**/*.ico

# SourceContent, whitelist source files other than code.
!SourceContent/**
!Plugins/*/SourceContent/**
# blacklist temporary or junk files.
**/*.blend1

Hey @Roy_Wierer.Seda145 , I’m happy that the tutorial sparks more ideas how to handle this problem, I knew using version control is best option but still wanted to share another approach, anyways your comment is vital to this tutorial and I’m sure people will appreciate your approach as well. Thanks !

1 Like