computer help index
 
 
Search:
"Offering free computer help, hints, and tips to the Internet populace." Now with over 3,820 tips!

Windows XP and DOS

Defragment Just One File or Directory

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

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

 

Discuss This Tip

Print This Tip

Get E-Mail When New Tips are Online

Return to the Windows XP and DOS page.


More in MalekTips:
Microsoft Internet Explorer 8Microsoft Publisher 2007Digital Waterfall Photography



Access a Favorite Website from Anywhere with a Keyboard ShortcutTwo Ways to Move a Page[MODIFIED] Avoid Water Vapor

Follow Us On Twitter
 
RSS Feeds - Subscribe!
 

You want the latest tech tips and tricks in your e-mail Inbox - FREE? Type your e-mail address below and click 'Get Tips!'.
 



( sample / details ) ( opt-out instructions )
 


 Free Offer! - Subscribe to the MalekTips computer help list and be one of the first to get new computer tips, articles, and download links! ( privacy policy )  ( opt-out instructions )
This page and its contents are copyright
©1997 - 2009 Envision Programming. ( copyright/disclaimer )

Home | Free Computer Help Newsletter! | Windows | Web Development | DOS and Batch Files | Removing Spyware
Digital Camera and Photography | Computer and Internet | Software | Microsoft Word
Computer Articles | About | Contribute a Tip | Link To Us! | Computer and Technology Links
RSS Feeds |  Contact Us | Advertising | Privacy Policy | Computer Help Forums