defrag

Optimises a disk by defragmenting the file system.
   defrag [/C] [drive:] [{/F|/U}] [/Sorder[-]] [/B] [/X] [/A] [/FO]

Options

   drive:
   This is the drive letter of the drive you wish to defragment. For instance:
          defrag c:

   /C
   Defrag will not use its menu-driven user interface if you use this option. It
   will communicate through the command line instead.
   You must use the [drive:] option, as described above, when you use
   the /C switch.

   /F
   With this option, defrag will perform a full optimisation by making sure
   that all files are at the beginning of the disk, with no gaps in between.

   /U
   With this option, defrag will unfragment the files, but gaps may be left
   between files.
   
   /Sorder[-]
   Defrag will sort files into the given order:
             N  by Name (alphabetic)            E by Extension (alphabetic)
             D  by Date & time (earliest first) S by Size (smallest first)
   Postfix the order with a hyphen - to sort descending.

   /B
   Reboots the computer after defrag completes the optimisation.

   /X
   Forces defrag to exit as soon as it completes the optimisation.

   /A
   With this option, defrag will give an audible warning before taking action.

   /FO:
   For use with the /C option, this tells defrag to give a more full
   output of information.

What is disk fragmentation?

When files are deleted, or made smaller, this leaves gaps in the data stored on the disk. If a file is created, or increases in size, it will go in the gaps, but if this space isn't big enough, the file will be continued elsewhere on the disk. After many such operations the file data can become very scattered. This fragmentation process slows down file access.

Fragmentation is a normal process on DOS disks.

When should I use defrag?

Use defrag occasionally, or after you have performed a very large file restructuring task.
Copyright © 2003-4 Rob Platt
This file forms part of The FreeDOS HTML Help Documentation, and is covered under its terms: see index.htm