You can set the "Hidden" file attribute. Sitecore will not patch in any hidden files, even if they have the .config extension. The same is also true for folders, setting the "Hidden" attribute will mean the folder is not processed and the files contained within will not be loaded either.
You can find the exact code in LoadAutoIncludeFiles()
method in Sitecore.Configuration.ConfigReader
class:
protected virtual void LoadAutoIncludeFiles(ConfigPatcher patcher, string folder)
{
if (!Directory.Exists(folder))
return;
foreach (string file in Directory.GetFiles(folder, "*.config"))
{
if ((File.GetAttributes(file) & FileAttributes.Hidden) == (FileAttributes) 0)
patcher.ApplyPatch(file);
}
foreach (string directory in Directory.GetDirectories(folder))
{
if ((File.GetAttributes(directory) & FileAttributes.Hidden) == (FileAttributes) 0)
this.LoadAutoIncludeFiles(patcher, directory);
}
}
NOTE: The above is decompiled code and I have modified it for berevity.