• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Find size of folder without using 'du'

Hi, is it possible to find the size of a folder without using 'du'?

I have 2 folders and they are supposed to contain exactly the same content, however, when I do a 'du' on each, they return different sizes.  Is it possible to return the exact size of these folders using something similar to the 'ls -la' command (which only reads the size of flat files).

Thanks
0
garry_m
Asked:
garry_m
  • 2
  • 2
1 Solution
 
bloemkool1980Commented:
if the size output is different it means they are not identical.
You could try checksums to see if it is equal or tar the directories and compare the tar files on size.
0
 
garry_mAuthor Commented:
I thought that 'du' only represented the size that the file uses on disk, if it is arranged differently via blocks etc on the two separate machines then the size may be different.  Is this correct thinking? Anyway, your idea of tarring them up is good enough for me to accept.  Thanks.
0
 
bloemkool1980Commented:
I have no idea about how it does it I thought it measured the actual file size and not the block size.
0
 
garry_mAuthor Commented:
I think (but I am no expert) that 'du' stands for 'disk usage', so that a file can be spread across many blocks, even if it only uses a small amount of space in each of those blocks, the disk usage returned will still show the total size of all those blocks put together, not the actual physical number of bytes in that file.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now