This tip was printed from the MalekTips Computer and Technology Help and Tips website at http://malektips.com.

Windows XP and DOS - Defragment Just One File or Directory

SUMMARY: Only defragment a particular file or directory that you frequently access.

If you frequently modify a particular file or directory on your Windows XP system, that file or directory may become fragmented more quickly than other files / directories on your hard drive. If so, while you can defragment the entire drive via a batch file, it may prove useful and quicker to just target the particular file / directory for defragmentation if it is changed often.

Defragmenting a single file or directory can be accomplished via the contig command, available from the Sysinternals site, part of Microsoft Technet.

Simply download the zip file contig.zip, unzip the contained executable to your main Windows directory, and you can defragment an often-changed file via the command prompt:

contig FILENAME

where FILENAME is the path to a file you wish to defragment.

Contig will display a copyright statement and then a summary, such as the following if the file does not need to be defragmented:

Summary:
Number of files processed : 1
Number of files defragmented: 0
All files were either already defragmented or unable to be defragmented.


Contig supports the following options:

-q

This runs contig in silent mode, only printing the copyright and summary information. If you want contig to run completely quiet, issue the following command:

contig -q FILENAME > nul

-v

This displays additional information about the defragmentation process.

-a

This only analyzes a file to see its fragmentation status and will not actually perform defragmentation.

-s

This recurses subdirectories, allowing you to defragment or analyze all files and subfolders inside a folder.

For example, to recursively defragment all files inside the directory c:\data and display added information about the defragmentation process, issue this command:

contig -v -s c:\data\

* Download Sysinternals Contig


 

 

Press the "print" button on your browser or select "File" - "Print" to print this tip. Then, return to Windows XP and DOS - Defragment Just One File or Directory

Standard disclaimer applies - read http://malektips.com/disclaim.html