Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!netnews.upenn.edu!rutgers!psuvax1!shire!deng From: deng@shire (Mingqi Deng) Newsgroups: comp.sys.ibm.pc Subject: confused: text files wastes space? How to correct it? Message-ID: <4295@psuvax1.cs.psu.edu> Date: 14 Feb 89 21:06:44 GMT References: <6358@phoenix.Princeton.EDU> Sender: news@psuvax1.cs.psu.edu Reply-To: deng@shire (Mingqi Deng) Organization: Penn State University Lines: 32 Keywords: 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. One reasonable explanation I can think of is as the following. The text file could had been created through many editing sessions, and the DOS simply uses additional sectors for the sectors to which new text has been inserted, rather than rewrite the whole file to opitmize space. This is a trade between speed and space. But for largre files, this is certainly a big waste. Does anybody know how to 'compact' the disk spaces used by text files? Thanks. Mingqi deng@shire.cs.psu.edu deng@psuvaxs.bitnet deng@psuvaxs.UUCP