0

I want to get the size of a folder I'm working on and I've tried the following:

  • right-click and check folder's properties (105.8MB)

  • Commands directly in terminal:

    • du -hsc * (last line where total appears 105MB)
    • du -sch (last line where total appears 418MB)
  • method from this answer: Calculating a directory size using Python? (418MB)

Why am I getting such different sizes?

Community
  • 1
  • 1
Didina Deen
  • 195
  • 2
  • 17

1 Answers1

0

du -sch * will ignore hidden directories, so you'll usually get a smaller size with the asterisk than just running du -sch. That's really the only difference between all your examples above.

If you just need this value for displaying to a user, then choose which of those you'd like to display.

If you need an exact size, the du command is probably not what you want, since it displays disk usage, which will be different than file size if the disk block is greater than 1 byte.

rgilligan
  • 754
  • 5
  • 18