undelete -- administer versioned files


undelete [ -dfir ] [-m [+-]days] file [ ... ]

undelete [ -l | -p | -v ] [ -dr ] [-m [+-]days] file [ ... ]

undelete [ -s | -u ] [ -r ] [-m [+-]days] directory [ ... ]


The undelete command is used to administer versioned files. It allows you to recover (or undelete) a previously unlinked (or deleted) file. undelete is the ability of a filesystem to transparently maintain versions of a file, and to restore a previous version of that file to be the current version.

For more information, see ``Retrieving deleted files'' in the Operating System User's Guide and ``Versioning filesystems (undelete)'' in the System Administration Guide.

The files are a list of files with optional appended version specifiers, consisting of a semicolon followed by a version number. If no version specifier is specified, the newest previous version is assumed.

Setting $SHOWVERSIONS to 1 in your environment allows all versions of files to be shown when a directory is searched.

NOTE: As with other special characters, the semicolon (;) symbol has a special meaning to the shell and causes termination unless quoted (that is, made to stand by itself). In this instance, the semicolon should be quoted by preceding it with a backslash (\). For example, file;2 is written as file\;2 to avoid premature termination.

undelete supports the following options:

If the -l, -p, -s, -u and -v options are not specified, undelete recovers the specified files.

print a listing of all versions of the specified file(s)

purge (permanently delete) specified source file(s)

turn the version attribute on for the specified directories and its subsequent child directories

turn the version attribute off for the specified directories

force the specified file(s) to be versioned

The following additional options are recognized:

normally, if the specified file is a directory, undelete will operate on the files contained in that directory. If this option is specified, undelete operates on the directory itself.

NOTE: undelete does not work on directories that are mounted.

undelete will prompt for confirmation prior to recovering a file that will overwrite the current version of the file. A y answer means that the undeletion should proceed. Any other answer prevents undelete from undeleting the file.

undelete will recover the file(s) without prompting even if it is overwriting over an existing current version of the file. This option overrides the -i option. Note that this is the default if the standard input is not a terminal.

undelete will operate recursively on any directories in the argument list. Symbolic links that are encountered with this option will not be traversed.

-m [+-]days
undelete will only consider files that were deleted less than ( - ), greater than ( + ) or exactly (neither - nor + ) days ago.


undelete does not work with special device files.


This example purges old versions of files to reduce undesirable pollution of the filesystem. In this instance, all versions older than 2 days are purged. You can add this to your crontab entry so it is performed regularly:
   undelete -rpfm+2 /home

See also

du(C), mount(ADM)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003