Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Find size of folder without using 'du'

Posted on 2004-09-09
4
Medium Priority
?
669 Views
Last Modified: 2008-02-01
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
Comment
Question by:garry_m
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
bloemkool1980 earned 200 total points
ID: 12015161
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
 

Author Comment

by:garry_m
ID: 12015198
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
 
LVL 6

Expert Comment

by:bloemkool1980
ID: 12015208
I have no idea about how it does it I thought it measured the actual file size and not the block size.
0
 

Author Comment

by:garry_m
ID: 12015228
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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question