Posts

Showing posts with the label size

Project Wild Penguin 22.4.2017: To delete directories inside current directory whose contents are less than a given size

With GNU find and GNU coreutils, and assuming your directories don't have newlines in their names: find . -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- This will list directories with total contents smaller than 50K. If you're happy with the results and you want to delete them, add | xargs -d \\n rm -rf to the end of the command line. Command: find . -mindepth 1 -maxdepth 1 -type d -exec du -ks {} + | awk '$1 <= 50' | cut -f 2- | xargs -d \\n rm -rf Source:  https://unix.stackexchange.com/questions/214089/command-to-delete-directories-whose-contents-are-less-than-a-given-size

Project Wild Penguin 23.4.2017: To list the size of sub-directories inside a directory using terminal

Simple command to list the size of sub-directories inside a directory using terminal : du -sh * | sort -h will get you a human-readable ascending list of the sizes of files and subdirectories in your current directory, du -sh will summarize the current directory size. Source:  https://askubuntu.com/questions/426809/how-to-list-the-size-of-a-directoy-and-subdirectories-and-files-inside-it-by-ter