Clean up your .gradle folder in just 2 cmd lines
Gradle is bloated over time, clean it is the only way.
If you are curious about their meaning, read the further below
find ~/.gradle -type f -atime +30 -delete
find
: This command searches for files and directories in a directory hierarchy. In this case, it starts the search in the~/.gradle
directory.~/.gradle
: This is the starting directory for thefind
command. The tilde (~
) represents the home directory of the user running the command.-type f
: This is a condition for thefind
command that specifies it should only look for files, not directories. The letter 'f' stands for files.-atime +30
: This is another condition for thefind
command that specifies it should find files that were last accessed more than 30 days ago. The+30
indicates "more than 30 days."-delete
: This is an action to be performed on the files the command finds. It deletes the files that meet the specified conditions.
find ~/.gradle -type d -mindepth 1 -empty -delete
find
: Similar to the previous explanation, it's a command-line utility used for searching files and directories.~/.gradle
: This is the starting directory for thefind
command, representing the.gradle
directory within the user's home directory (~
).-type d
: This flag specifies that thefind
command should only look for directories. The letter 'd' stands for directories.-mindepth 1
: This sets the minimum depth level for the search to 1. It means the search excludes the top-level directory (.gradle
), ensuring that only subdirectories are considered.-empty
: This is a condition for thefind
command, specifying that it should locate empty directories.-delete
: This is the action to be performed on the directories that meet the specified conditions. It deletes the empty directories found within~/.gradle
.
Itβs the last day of 2023, Letβs cleanup your work space and start a brand new year of 2024!
Happy coding!