Conditionally package additional directories based on build configuration

I’m looking for a way to control additional non-asset directories to package/copy based on the build configuration.

In the Packaging section of the Project Settings, I can add additional non-asset directories to either be included in the package or copied over to the build’s folder.

We have some text files in a folder that we load in via Unreal’s file management (e.g. FFileHelper::LoadFileToStringArray, etc.) and the build runs fine whether we copy or package.

During development, it’s quite handy for these files to be copied over so we can easily tweak them in a build without having to cook again each time. However, for a shipping build, we’d like to tidy these away in the package.

I was wondering if there was a convenient way to achieve this? Include some folder as a non-asset directory to copy except if it’s a Shipping build – in that case, include this folder as a non-asset directory to package.

It’s easy enough for us to just change this in Project Settings before cooking, but it’d be nice if this was automated so there’s less chance of people making mistakes.

Perhaps something I can add in the *.Build.cs file, or the *.Target.cs file? Or maybe write the desired settings to DefaultGame.ini at an appropriate time (say, after building but before cooking)?