Recovering from Sync Error / Internal Server Error for Directory with 40k files

I keep getting a Sync Error / Internal Server Error with a particular folder with about 38k text files in it (very small; totaling about 30 MB). It is manifesting as a “Allowed memory exhausted” error but it is always this same folder with many text files. My understanding is that increasing the memory available is nontrivial in the Snap package, and shouldn’t be necessary anyway.

{"reqId":"tNj77Nu1B4ljKpGvTSIp","level":3,"time":"2018-04-03T08:19:18+00:00","remoteAddr":"<redacted>","user":","<redacted>":"PHP","method":"PROPFIND","url":"<path to directory with 38k files>","message":"Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) at \/snap\/nextcloud\/5627\/htdocs\/lib\/private\/Files\/Cache\/CacheEntry.php#41","userAgent":"Mozilla\/5.0 (Macintosh) mirall\/ 2.3.3 (build 84) (Nextcloud)","version":"12.0.5.3"}

It’s not critical that I keep that many files in a directory (it’s for an old project at this point; I can just zip it)—I just need to figure out how to get NextCloud to stop complaining and continue with the scan. I tried removing the offending directory on the client, but 1) it’s still there in my user data file on the server and 2) I keep seeing the error in the Nextcloud server logs every 20 minutes. Will it work / is it safe for me to enter maintenance mode, delete the directory on the server, and re-scan?

Nextcloud version 12.0.5
Operating system Ubuntu 16.04
Using 12.0.5snap2