Finding out the biggest folders in a Magento or other website root

Often pulling down a Magento or other site you’ll find a load of files that have been dumped in the web root. Downloading these is often pointless and takes extra time, so you’ll want to exclude them from an rsync (using the --exclude 'path' paramter).

A simple bash command for this is:

du -m --max-depth=1 --exclude media | sort -n

This invokes du to show each direct subfolder’s contents’ size, and pipes it through to sort to rank them in increasing size. The sizes are in MB. See a more broken down explanation here

Tags: bashmagentolinuxshellfilesrsync