I'm working in a directory
~/foo which has subdirectories
~/foo/alpha ~/foo/beta ~/foo/epsilon ~/foo/gamma
I would like to issue a command that checks the total size under each "level 1" subdirectory of
~/foo and deletes the directory along with its contents if the size is under a given amount.
So, say I'd like to delete the directories whose contents have less than
$ du -sh */ returns
8.0K alpha/ 114M beta/ 20K epsilon/ 1.2G gamma/
I'd like my command to delete
~/epsilon along with their contents. Is there such a command? I suspect this can be done with
find somehow but I'm not quite sure how.