Wiping Deleted Directory Entries and Defragmenting Directories

Posted by Synetech inc. on Super User See other posts from Super User or by Synetech inc.
Published on 2009-11-24T19:12:26Z Indexed on 2010/03/31 20:03 UTC
Read the original article Hit count: 481

Hi,

I have seen plenty of apps that wipe free space on a disk (usually by creating a file that is as big as the remaining space) or defragment a file (usually by using the MoveFile API to copy it to a new contiguous area).

What I have not seen however is a program that wipes the deleted directory entries. That is, when a file is deleted, its information (name, dates, etc.) remain in the directory, but are simply marked as empty. That leaves all kinds of information in a directory entry, and also wastes space since (at least on FAT drives), the directory may be using several clusters. For example, if a directory once had a lot of files, it will be expanded to use another cluster which could be anywhere on the disk. This means that the directory is fragmented, and may be using more clusters than needed, possibly with 100’s of unused (ie, “deleted file”) entries between active files.

Does anyone know of a program that can defragment/consolidate directories (ie, wipe unused entries, and move active entries together)?

(I would really rather not have to resort to writing my own yet again.)
Thanks a lot.

EDIT Sorry, I should have said, Windows and/or DOS, for FAT*/NTFS.

© Super User or respective owner

Related posts about defragment

Related posts about directory