Microsoft Knowledge Base Email Alertz

KBAlertz.com: (72043) - A directory listing using the DIR command under Microsoft MS-DOS version 5.0 or later reports the total number of bytes in the files for that specific directory. The disk space occupied by these files can be much greater than the byte total reported...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 72043 - Last Review: May 12, 2003 - Revision: 2.0

Byte Total Returned by DIR Less Than Bytes Used

This article was previously published under Q72043

On This Page

SUMMARY

A directory listing using the DIR command under Microsoft MS-DOS version 5.0 or later reports the total number of bytes in the files for that specific directory. The disk space occupied by these files can be much greater than the byte total reported by DIR, depending on the disk's allocation unit size. This difference may cause confusion when calculating disk space requirements for copying files.

NOTE: File storage is handled the same under all versions of MS-DOS; the 5.0 DIR command is the first MS-DOS command to list the number of bytes stored in a particular directory.

MORE INFORMATION

The minimum storage space on an MS-DOS disk is one allocation unit. Each allocation unit contains one or more sectors, depending on the disk size and capacity. Sectors can also vary in size but are usually 512 bytes.

Since files seldom fill a single allocation unit entirely, a number of bytes are left unused. These bytes are unavailable to MS-DOS for any other file storage. For example, if the allocation unit size is 1024 bytes, a file of 1000 bytes occupies one allocation unit, leaving 24 bytes unused and unavailable to MS-DOS for storage of other files.

Calculating Disk Space Requirements



PC utility programs like Norton Utilities and PCTools determine the number of bytes in a particular directory as well as the number of bytes occupied on the current disk. If you do not have one of these programs, you can estimate disk space requirements.

To estimate the number of bytes occupied by the files in a particular directory, you must determine the allocation unit size for the disk. CHKDSK return the allocation units for a MS-DOS disk.

The following equation is based on the law of averages that dictates that one-half of an allocation unit will be unused for each file stored on a disk. The more files you have in a particular directory, the closer the estimate will be. If you have just a few small files, this formula is not accurate.
   disk space occupied = (number of files in directory *

                         allocation unit size in bytes * .5) +
                         file size total reported by DIR
				
Use the following method to estimate the disk space required to copy the files in a directory to a disk. Use CHKDSK to determine the allocation unit size of the destination disk. Use the same equation as above, substituting the allocation unit size of the disk for the allocation unit size in bytes.

For more information on allocation unit sizes, query on the following words here in the Microsoft Knowledge Base:
allocation and unit and fat and disk

REFERENCES

More information on this topic can be found in "The MS-DOS Encyclopedia," "Advanced MS-DOS Programming," or "The NEW Peter Norton Programmer's Guide to the IBM PC & PS/2," which are published by Microsoft Press.

APPLIES TO
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
Keywords: 
KB72043
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please