Find Total Size for All Files in a Directory in Linux

In Windows, if you right-click on a folder and select Properties, one of the useful things that you get is the sum of sizes of all files contained in the folder and its sub-folders. It may take a while if there are a lot of files and folders. This number can be very useful in certain situations. For example, when copying a large hierarchy of files from one place to another during backup or relocation, it helps to check that all files were copied successfully, and one of these checks is to compare the total size of data in source and destination.

When copying between Windows and Linux, the problem is that while Gnome does provide a similar feature,  the size reported is not precise and it includes sizes of folders as well. To get the same size as reported by Windows, go to command line, change to the root of the directory hierarchy you need the total file size for, and type

find -type f -printf "%s\n"|awk '{sum+=$0}END{print sum}'

Thanks goes to ghostdog74 and others at LinuxQuestions.org