Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!netnews.upenn.edu!eniac.seas.upenn.edu!silver From: silver@eniac.seas.upenn.edu (Andy Silverman) Newsgroups: comp.sys.ibm.pc Subject: Re: confused: text files wastes space? How to correct it? Message-ID: <8029@netnews.upenn.edu> Date: 15 Feb 89 18:31:38 GMT References: <6358@phoenix.Princeton.EDU> <4295@psuvax1.cs.psu.edu> Sender: news@netnews.upenn.edu Reply-To: silver@eniac.seas.upenn.edu.UUCP (Andy Silverman) Organization: University of Pennsylvania Lines: 33 In article <4295@psuvax1.cs.psu.edu> deng@shire (Mingqi Deng) writes: >While using NC and Norton utility programs, I found that disk spaces >were used very ineffeciently with ASCII files (nearly 40% wasted). > >Both NC and Norton showed that the space used by some of my text files >used space up to 78% percent more than their 'real size' (shown by DIR >command). (What was actually shown is the space used by all the files >in a directory. FS of Norton gives an explicit report of percentage >slackness. I figured out for NC.) > >I am confused. I know each sector is 512 (256? The real figure is not >very important here.) bytes in DOS 3.3 and any file whose size is not a >multiple of 512 bytes will leave last sector allocated for it to be >partially empty. But this only makes the space used increase by about >500 bytes. My files are not just 200 bytes in size. That is why I am >puzzeled. > Well, the fallacy here is that while a sector in DOS does indeed contain 512 bytes, all files are allocated in minimum units of "clusters." A cluster on a floppy is usually 2 sectors (1K of data), and hard drives have cluster sizes ranging from 4 to 16 sectors, depending on the size of a drive. So while you may have a text file that's only 15 bytes, it will take up a minimum of 1K on a floppy, or 2K or even 8K on a hard disk. Norton's program reports on "slack" which is the difference between a file's true size and the amount of space it takes up on the drive (determined by cluster size). One way to compress text files so that they take up less drive space is to use a program like ARC or PKPAK to combine several text files into one large library file, which is then further squashed using mathematical techniques to reduce disk usage even more. Andy Silverman Internet: silver@eniac.seas.upenn.edu CompuServe: 72261,531