LinuxCommandLibrary

mdel

Delete files on an MS-DOS filesystem

SYNOPSIS

mdel [-v] [-w] [-f] [-i] [-p] [-s] [-n] [-m] [-/@] msdosfile [msdosfile...]

PARAMETERS

-v
    Verbose mode. Displays more information about the files being deleted.

-w
    Wait for a key press before deleting each file. Useful for confirming deletions one by one.

-f
    Force deletion. Deletes read-only files without prompting. Be very careful with this option.

-i
    Interactive mode. Prompts for confirmation before deleting each file, including read-only files.

-p
    Purge. Overwrites the file data before deleting it, making recovery more difficult. This option increases deletion security.

-s
    Delete system files. Requires explicit confirmation and extreme caution.

-n
    No Execute Mode. Do not perform the command, but show a report of the actions that would be done.

-m
    Delete files with matching archive bits (like DOS del /a:a).
Note: this is currently broken.

-/@ filelist
    Read the list of files to delete from the specified file, one filename per line.

msdosfile
    The name of the file or files to delete on the MS-DOS filesystem. Wildcards (* and ?) are supported.

DESCRIPTION

The `mdel` command is used to delete files from an MS-DOS filesystem (e.g., a floppy disk, USB drive formatted with FAT). It is part of the `mtools` suite, which provides tools for accessing and manipulating MS-DOS filesystems from within a Linux environment. `mdel` allows you to remove files from these filesystems without having to boot into DOS or Windows. It provides wildcard support, enabling you to delete multiple files at once.

Important: `mdel` operates directly on the filesystem. Ensure you are targeting the correct filesystem and be cautious when deleting files, as recovery might not be possible. When working with MS-DOS filesystems be aware of the 8.3 Filename limit in place for older systems. To avoid mistakes, always check the current working directory and target file system before deleting files.

The command supports a range of options to control its behavior, including handling of hidden, system, and read-only files. It uses the settings in the `mtools.conf` file to determine how to access the MS-DOS filesystem.

CAVEATS

Deleting files on an MS-DOS filesystem using `mdel` bypasses the Linux recycle bin. Deleted files are usually unrecoverable, so use caution. Ensure you have write access to the target filesystem before attempting to delete files. Pay attention to filesystem permissions and the implications of the -f and -s options.

CONFIGURATION

mdel reads its configuration from ~/.mtoolsrc (or /etc/mtools.conf if the file doesn't exist in your home directory).
These configurations include information regarding drive letters and associated devices. It is important that the file is properly configured to avoid deleting files in the wrong partition or device. You will need to configure your mtools.conf file according to the documentation provided in the mtools package.

HISTORY

The `mtools` suite, including `mdel`, was developed to provide Linux users with the ability to access and manipulate MS-DOS filesystems. It was created because early versions of Linux lacked native support for FAT filesystems. The `mdel` command has evolved over time to support various features and options, such as handling different file attributes and providing verbose or interactive modes.

SEE ALSO

mcopy(1), mdir(1), mformat(1), mmd(1), mrd(1), mattrib(1)

Copied to clipboard