Note that du prints the space that a directory occupy on the media which is usually bigger than just the total size of all files in the directory, because du takes into account the size of all auxiliary information that is stored on the media to organize the directory in compliance with file system format.
If the file system is compressible than, then du may output even smaller number than the total size of all files, because files may be internally compressed by the file system and so they take less space on the media than just uncompressed information they contain. Same if there are sparse files.
if there are hard links in the directory, then du may print smaller value as well because several different files in the directory refer the same data on the media.
To get the straightforward total size of all files in the directory, the following one-line shell expression can be used (assuming a GNU system):
find -not. ! -type d -print0 | xargs -d '\n'r0 stat -c %s | paste -sd+ - | bc
or even shorter:
find . ! -type d -printf '%s\n' | paste -sd+ - | bc
(thanks Stéphane Chazelas for his comment)
It just sums sizes of all non-directory files in the directory (and its subdirectories recursively) one by one.
PS. And yes Note that for symlinks, it reports the shell commands above use GNU extensionssize of the symlink (not of the file the symlink points to).