How MS-DOS 6.22 MOVE Renames Directories

This article explains the internal mechanics of the MS-DOS 6.22 MOVE command when used to rename directories. While earlier versions of MS-DOS required tedious workarounds to rename folders, MS-DOS 6.0 and 6.22 introduced directory renaming via the external MOVE.EXE utility. Rather than copying and deleting underlying files, the operating system executes an in-place directory entry update at the filesystem level, enabling instant directory renaming.

In MS-DOS versions prior to 6.0, the native REN (or RENAME) command was restricted to files, returning an error if a user attempted to alter a directory name. To bypass this, users had to make a new directory (MD), copy the files over (XCOPY), delete the originals (DEL), and remove the old directory (RD). MS-DOS 6.0 introduced MOVE.EXE to solve this limitation, maintaining the same functionality in MS-DOS 6.22.

The command syntax for renaming a directory is:

MOVE [drive:][path]oldname newname

The Underlying Filesystem Mechanism

When MOVE is executed to rename a directory on the same logical drive, it does not touch the files or subdirectories stored inside that folder. Instead, it relies on standard File Allocation Table (FAT) filesystem structures and MS-DOS kernel functions:

  1. System Call (INT 21h, Function 56h): The MOVE utility parses the command-line arguments and validates that the source and target are located on the same drive. It then invokes DOS Interrupt 21h, Service 56h (Rename File / Directory).
  2. Directory Table Modification: In FAT12 and FAT16 filesystems, a directory is simply a special file containing a list of 32-byte directory entries. The operating system locates the 32-byte entry for oldname in the parent directory table.
  3. Name and Attribute Overwrite: The OS verifies that newname does not already exist in the target location. Once validated, it updates the 11-byte filename/extension field (8.3 format) in the parent directory entry with the new name.
  4. Cluster Preservation: The starting cluster pointer in the directory entry remains unchanged. The File Allocation Table chain linking the directory's internal contents is not rewritten or relocated, meaning the operation executes virtually instantaneously regardless of directory size.

Limitations and Error Handling

The directory-renaming capability of MOVE has strict operational boundaries:

  • Same-Drive Constraint: MS-DOS 6.22 cannot move an entire directory structure across different drive letters (e.g., from C:\OLD to D:\NEW). Attempting to do so causes the command to abort, as FAT architectures cannot repoint cluster allocations across separate volumes.
  • Open File Conflicts: If a file within the target directory is locked or currently accessed by a background program or TSR (Terminate and Stay Resident), the DOS interrupt returns an error, leaving the original directory name intact.
  • Root Directory Restrictions: The root directory (\) cannot be renamed because it is a fixed structure defined by the volume geometry rather than a variable directory entry in a parent table.