That's some handy code above to have. Thanks for that and I'll use it myself.
Also, you can go to the 'Configure User and System Paths' panel and see where the Page File, Temp and Hardware Shaders Cache is and change it if you want. See the attachment.
But, I will tell you this. I've been using Max for 29-years and I've had all kinds of crashes, issues, malfunctions, problems, etc., and I can't think of a single situation where clearing the cache, or any cache, solved anything. For whatever reason, and I think it's a good one, Max's cache and temp files just don't affect it and cause it to malfunction like might happen in other software, from my perspective anyway.
Rob Holmes
------------------------------------------------------------------------------------------------------------------------------------------
3ds Max (2023-2025), V-Ray 6.2, Ryzen 9 3950-X Processor, DDR 4 128MB, Gigabyte Aorus X570 Master motherboard, Sabrent Rocket NVMe 4.0 M.2 drives, NVidia RTX 4090, Space Pilot Pro, Windows 11 Pro x64, Tri-Monitor, Cintiq 13HD, Windows 11 x64
------------------------------------------------------------------------------------------------------------------------------------------