Reputation: 9113
I'm developing in Android Studio with gradle.
My .gradle/daemon/ takes up to 50GB of space.
It consist of about 50 files between 1MB and 3GB in size.
How can I reduce size of that folder? How to clean it up safely?
Upvotes: 7
Views: 8359
Reputation: 61
On Windows, on the other hand, you may do something like this:
Create in your gradle folder a batch script (text file), with a filename 'clean-logs.bat'.
Inside, you can put just one line with the command as follows:
del C:\Users\username\.gradle\daemon\*\*.log
'username' should be replaced with the right one for you and basically complete path should point correctly to where your gradle instalation is placed and it's logs files are generated.
You can test your simple script manually by double-clicking on it, or running it from Command prompt - it should erase all logs in '.gradle' folder - without reporting an error, if there are some existing at the moment.
Now you can schedule this task - for automatic repeated clean-ups, as follows:
That should basically do it.
Upvotes: 2
Reputation: 61
You could for example, regularly delete *.out.log files in your home directory .gradle folder, by following command:
find ~/.gradle -name '*.out.log' -exec rm {} \;
You can put it with crontab -e to be repeated periodically at some appropriate time.
In this example, 'cleaning' would be executed on 11am every Monday:
$ crontab -l
0 11 * * 1 /usr/bin/find ~/.gradle -name '*.out.log' -exec rm {} \;
This will work on any linux or mac os x.
Upvotes: 3