# Command: undelete

      UNDELETE attempts the recovery of deleted files.

## Syntax:

      undelete [directory] [options]
               directory  The location where the file to be undeleted is.
                          If no directory is given, the current working
                          directory is assumed.
      There are also more advanced undelete options:
      undelete /action what destination [size]

#### [Main menu] [top] (Syntax) [Options] [Comments] [Examples] [See also] [File]

## Options:

        /ALL         Undelete ALL files in the given directory without
                     prompting for each file.
        /LIST        Lists files that can be undelete without prompting to
                     undelete; no action is taken.
        /E           Exports any undeleted files to an external disk and
                     directory. With this option the source disk isn't
                     modified.
      Possible [action]s:
        /syssave     Saves the 1st or 2nd copy of the FAT, boot sector or root
                     directory. Select fat1, fat2, boot, or root in [what].
        /follow      Looks for a (possibly deleted) file starting at the
                     cluster [what] and saves data to a file given as
                     [destination]. The output of DIRSAVE helps you to find
                     the right cluster number.
        /dirsave     Like FOLLOW, but saves a directory to a file. Directory
                     [what] must be given by an absolute path starting with
                     \ OR by a cluster number. Also shows a technical directory
                     listing on the screen.
        destination  must be on a drive other than the current drive. Data is
                     always read/recovered from the drive from which undelete
                     is invoked.
        size         Specifying size is not needed, but you can override the
                     autodetection by specifying size (in clusters for FOLLOW,
                     in sectors for DIRSAVE).

#### [Main menu] [top] [Syntax] (Options) [Comments] [Examples] [See also] [File]

## Comments:

      UNDELETE only works on FAT12 / FAT16 disks!
      Using UNDELTE:
        1. Finding undeleteable files and directories:
           Run undelete in DIRSAVE mode. You will see deleted directory
           entries specially marked, and you will see their cluster numbers
           on the screen. You can redirect screen output to a file, for example:
             undelete /DIRSAVE \ x:\rescued.dir >y:\logfile
           Where logfile will contain the screen output.
           If you have the FreeDOS utilites installed on your system, you
           could use something like one of the following instead:
             undelete /DIRSAVE \ x:\rescued.dir | TEE y:\logfile
             undelete /DIRSAVE \ x:\rescued.dir | TEE y:\logfile | MORE
           These will display the information on screen as well as store it
           in the logfile.
        2. Recovering an undeleteable file
          Find the starting cluster of the file using DIRSAVE, as explained
          above. Then use FOLLOW on that cluster, for example:
            undelete FOLLOW 1234 x:\rescued.bin
          would save the contents of the deleted file starting on cluster 1234
          to the file rescued.bin on drive x.
      Advanced Uses
        - Recovering from within deleted directories
          Run DIRSAVE on an existing directory to find the starting cluster
          of the deleted directory. Then run DIRSAVE on that cluster to find
          deleted files and directories within the deleted directory... and
          so on with successive cluster numbers as required.
        - Recovering partially overwritten files
          Use FOLLOW on the existing new files and override the size value
          (in clusters, undelete tells you how big a cluster on the current
          drive is when you start undelete). So, if you have accidentally
          overwritten a long file "OLD" with a short new file "NEW":
          * find the cluster number of "NEW"
          * give the size of "OLD" when using FOLLOW
          * The recovered output will begin with the contents of "NEW" but
            should contain the not-overwritten end of "OLD" as well, hopefully.
        - Using undelete to "mirror" important drive data
          If your filesystem gets completely broken, you can try to write back
          the important data saved by SYSSAVE. The saved information has to be
          stored on a separate disk. You may also wish to use the MIRROR
          command, which is simpler to use but stores the saved information at
          the end of the disk.
          * Run undelete in SYSSAVE mode for all 4 sources: fat1, fat2, boot,
            root
          * Keep the files in a safe place
        - Restoring the "mirror" data
          This may be necessary in some cases of disk disaster.
          WARNING: This is for experts, repair-men and very desperate people
          only! Doing this incorrectly or unnecessarily could make things
          worse!
          * Glue the 4 sources together in the order "boot fat1 fat2 root" to
            reconstruct the first part of your partition, starting with the
            first sector.
          * you could use DEBUG (w command) to restore this info
          * You can also merge saved and existing data with a hex editor.

#### [Main menu] [top] [Syntax] [Options] (Comments) [Examples] [See also] [File]

## Examples:

      - see comments -

#### [Main menu] [top] [Syntax] [Options] [Comments] (Examples) [See also] [File]

## See also:

      debug
      del
      deltree
      erase
      format
      mirror
      more
      rd
      rmdir
      tee
      unformat

#### [Main menu] [top] [Syntax] [Options] [Comments] [Examples] (See also) [File]

## File:

      Please read this command's lsm file also.
      You will find the updated version (internet) here and
      the version described in this manual page here.
      The lsm file contains information about the name of the programmer,
      the download site, and some other command related information.

#### [Main menu] [top] [Syntax] [Options] [Comments] [Examples] [See also] (File)

      Copyright © 2003 Eric Auer, updated 2008 by W. Spiegl.

      This file is derived from the FreeDOS Spec Command HOWTO.
      See the file H2Cpying for copying conditions.