mdeltree
Remove directories recursively on an MS-DOS filesystem
SYNOPSIS
mdeltree [-v] drive:directory [drive:directory...]
PARAMETERS
-v
Displays each file and directory as it is deleted (verbose mode).
DESCRIPTION
mdeltree is a command-line utility from the mtools package, designed to recursively remove directories and their contents from MS-DOS filesystems. It functions similarly to the rm -rf command on Unix-like systems, but specifically targets DOS-formatted media.
mdeltree can delete hidden, read-only, and system files and directories without requiring user confirmation, making it a powerful tool for cleaning up DOS disks or partitions. It requires specifying the drive letter (e.g., a:, c:) followed by the path of the directory to be deleted.
Its primary use case involves managing files on floppy disks, USB drives, or partitions formatted with FAT12, FAT16, or FAT32 filesystems, often in environments where direct MS-DOS access is not available or preferred.
CAVEATS
mdeltree does not prompt for confirmation before deleting files or directories, including read-only or hidden ones. Care must be taken to ensure the correct directory is specified, as deletion is irreversible. It operates on MS-DOS/FAT filesystems and is not intended for native Linux filesystems like Ext4 or XFS.
FILESYSTEM SUPPORT
mdeltree specifically works with MS-DOS FAT filesystems (FAT12, FAT16, FAT32) and is not designed for native Linux filesystems such as Ext2/3/4, XFS, Btrfs, etc.
DRIVE SPECIFICATION
The drive:directory argument specifies the MS-DOS drive letter (e.g., a:, c:) to which the directory belongs. This often maps to a physical floppy drive or a partition on a hard drive or USB stick configured in /etc/mtools.conf.
HISTORY
mdeltree is part of the mtools suite, which was developed to provide Unix-like utilities for accessing MS-DOS filesystems. The mtools package has been around since the early days of Linux, serving as a crucial bridge for interoperability between Unix-like systems and DOS-based media. Its development has focused on maintaining compatibility with various FAT filesystem versions (FAT12, FAT16, FAT32) and providing robust command-line tools for file management without needing to explicitly mount the DOS partition.