Defragment Specific File or Folder in Windows

Print View Mobile View

There are many disk defragmenting software available in the market, such as Auslogics Disk Defrag, Diskeeper, and SmartDefrag. These tools perform a general defragmentation of your entire partition, which can take quite a while to complete. If all you want to do is optimize the performance of a certain disk-intensive application file like Outlook’s PST file, a database file, or a game. There’s no guarantee those software will defragment the files you want, while most files are generally defragmented on the drive. To assure your files are defragged, and those files only, here are three free software for you:

GUI based Programs to Defragment Specific File or Folder

WinContig
WinContig is a free (for personal and commercial use) portable defragmentation tool that allows you to quickly defrag specific files or folders without the need to defrag the whole drive.

Usage
To use the program, just extract the downloaded ZIP file to a folder on your computer and run WinContig (32-bit) or WinContig64 (64-bit) depending on your system. This will bring the main program interface:
WinContig
In it, click on Add button and select the file(s)/folder(s) you wish to defragment. After adding, go to Action > Defragment to start the optimizing process.

WinContig comes with a very helpful profiles feature. What this feature basically does is that it allows you to create profiles for one or more folder(s) containing files that you regularly modify. After creating a profile (.wcp file), whenever you want to defragment the same set of files/folders, you just have to load the saved profile. No need to again select each file each time.

Another handy feature is support for command-line switches. It’s usable like this:

WINCONTIG.EXE /DEFRAG /PROF:"c:\files\profile.wcp"

You can view the whole list of supported switches from Help > Show Command Line Switches.

WinContig is compatible with both 32-bit and 64-bit versions of Windows 8, Windows 7, Windows Vista, Windows XP and Windows 2000 operating systems.

Download: WinContig

Defraggler
Defraggler is another free program that allows defragmenting of individual files or folders.
Defraggler
With Defraggler, you can easily select a file, a folder, or multiple files to defrag from the program window and from the context menu of the file or folder. For the context menu option, shell integration has to be selected while installing the program.

If you don’t want Defraggler to defragment certain files, you can add those file to the Exclude list. This can be useful if, for instance, you don’t want to spend time processing large movie files. Here also you can add multiple rules for file exclusion, while includes specific file(s), file location, and file types. Exclude option is accessible by going to Settings > Option > Exclude tab.

Defraggler is compatible with Windows 2000 and higher.

Download: Defraggler

Command-line Program to Defragment Specific File or Folder

Contig
If you’re an experienced PC user who likes working on the command-line, then you might find Config to be quite useful.
Contig
Contig is a tiny commmand-line disk defragment tool which optimizes only those files and folders that you specify.

To use Contig, point at a file (or set of files) by entering a command like this, for instance:

Contig file.exe
Contig C:\
Contig C:\folder\*.*
Contig C:\folder\folder\*.dll

It will then analyze and defragment those files.

Contig uses the standard Windows defrag API, so even if the electricity goes off or if you turn your system off while it’s running, you can be reasonably sure that it’s not going to corrupt your hard drive.

Contig has a useful set of command line switches, they are:
-a: Analyze fragmentation
-f: Analyze free space fragmentation
-l: Set valid data length for quick file creation
-q: Quiet mode
-s: Recurse subdirectories
-v: Verbose

And the program can even analyze and defragment key NTFS structures such as: $Mft, $LogFile, $Volume, $AttrDef, $Bitmap, $Boot, $BadClus, $Secure, $UpCase and $Extend.

The only downside of this utility is its performance. When working on large heavily-fragmented files/folders it can take forever to complete the process. In such circumstances you’re better of using one of the GUI-based programs from above.

Download: Contig