MS-DOS 6.22 File Timestamps During Copy Operations
When copying files across disk partitions in MS-DOS 6.22, the
operating system preserves original file timestamps through explicit
interrupt calls rather than direct filesystem-level replication. Because
partitions maintain independent File Allocation Tables (FAT) and root or
subdirectory tables, MS-DOS cannot simply update a pointer. Instead,
standard utilities like COPY and XCOPY query
the modification date and time of the source file, create a new file
entry on the destination partition, write the data, and programmatically
overwrite the destination file's timestamp with the original source
metadata before closing the file handle.
The FAT Directory Structure
Under the FAT16 filesystem utilized by MS-DOS 6.22, file metadata is stored in a 32-byte directory entry. Unlike modern filesystems, standard MS-DOS FAT does not record distinct file creation times or last-access times; it only maintains a single 16-bit time field and a 16-bit date field indicating the last modification:
- Time (2 bytes): Encodes hours (5 bits), minutes (6 bits), and two-second increments (5 bits).
- Date (2 bytes): Encodes the year offset from 1980 (7 bits), month (4 bits), and day of the month (5 bits).
The Interrupt 21h Workflow
When a cross-partition copy is initiated (such as
COPY C:\DATA.TXT D:\BACKUP\), the MS-DOS command processor
(COMMAND.COM) handles the file transfer at the logical API
level using DOS Interrupt 21h:
- Opening the Source File: MS-DOS opens the source
file on the source partition using
INT 21h, Function 3Dh(Open File via Handle). - Retrieving the Original Timestamp: The utility
queries the file's current date and time using
INT 21h, Function 5700h(Get File Date and Time). This retrieves the 16-bit date and 16-bit time words directly into theDXandCXregisters. - Creating the Destination File: On the target
partition, MS-DOS calls
INT 21h, Function 3Ch(Create File) to allocate a new directory entry and handle. At this initial step, the system clock automatically provides a temporary current timestamp to the new file entry. - Writing the Payload: Data blocks are read from the
source (
INT 21h, Function 3Fh) and written to the destination (INT 21h, Function 40h) cluster by cluster across the partition boundary. - Reapplying the Timestamp: Crucially, before the
file is closed, the copy routine invokes
INT 21h, Function 5701h(Set File Date and Time) against the target file handle. This function pushes the previously storedCXandDXregister values into the target file's directory entry. - Closing the File: The operation completes with
INT 21h, Function 3Eh(Close File Handle), flushing the buffers and committing the updated 32-byte directory entry to the destination partition's directory table.
Cross-Partition Isolation
Because partitions operate as isolated logical structures with their
own boot sectors, allocation tables, and directory sectors, MS-DOS 6.22
cannot perform sector-level moves or directory entry repointing outside
of a single volume. Timestamp integrity depends entirely on user-space
file-management commands utilizing the
INT 21h, Function 57h API pair. If a custom utility or
third-party program creates a target file and closes it without
explicitly calling Function 5701h, the file receives the
real-time system clock values instead of the source timestamp. Both
native COPY and XCOPY commands incorporate
this explicit API call by default, ensuring that file age and
modification records remain identical across differing drives and
partitions.