Starting with build 15014, a new option appeared in Settings. Open Settings and go to System -> Storage. There, you will find the option named "Storage Sense". Enable it and you are done.Clear Temporary Files Automatically In Windows 10Windows  will remove all the temp folder's content automatically.

The user can customize this behavior. To do this, click the link "Change how we free up space" under the switch.

Change How We Free Up SpaceThe related page will be opened:Change How We Free Up Space PageThat's it.



Source: https://winaero.com/blog/clean-up-temp-directory-automatically-in-windows-10/