nrm, urm	- recoverably remove and restore files

      nrm  [-dfhirRsv]	[-t  ]   [--gracetime   ]	[--directory]
      [--force]    [--interactive]   [--recursive]   [--sequenced]   [--help]
      [--version] [--verbose] name...
      urm [ -f ] name ...

      Nrm is a local replacement for  rm(1).   Nrm  removes  each  specified
      file.  By default, it does not remove directories.

      Files   of   name   dirpath/basename   are   recursively	 moved	  to
      dirpath/.gone/basename  rendering them normally invisible except by ls
      -a. Such files are also  implicitly  marked  for	future	deletion  by
      updating their access time.

      Nrm lets you  use  the  --  option  to  indicate	that  all  following
      arguments  are  non-options.   To  remove  a  file  called `-f' in the
      current directory, you could type either
	   nrm -- -f
	   nrm ./-f

      -d, --directory -r, -R, --recursive
	   Remove the contents of directories recursively.  If a  designated
	   file  is  a	directory,  an	error  comment is printed unless the
	   optional argument -r has been used.	In that  case,	nrm  renames
	   the	 directory,  making  it  invisible  and  subject  to  future

      -f, --force
	   Ignore nonexistent files and never prompt  the  user.   No  error
	   messages  are  printed  when  the  -f  option  is given or if the
	   standard input is not a terminal.

      -i, --interactive
	   Prompt whether to rename each file and, under  -r  ,  whether  to
	   rename  each  directory.  If the response does not begin with `y'
	   or `Y', the file is skipped.  Answering 'q' or 'Q' will abort the

      -s, --sequenced
	   If the -s (sequenced  backup)  option  is  given,  nrm  will  not
	   overwrite  saved entries in the .gone directory, but instead will
	   save each file with a unique suffix such that every deleted	file
	   is preserved for the full gracetime number of days.

	   On long-filename systems, the suffix  is  of  the  form:  "-YEAR-
	   MONTH-DAY-HOUR:MIN:SEC",  where  each named field is 2 characters
	   long: eg., "foo-93-05-09-21:32:17".	If two	files  of  the	same
	   name  are  deleted  within  the  same second (thereby potentially
	   mapping to the same name), the conflict is avoided  by  adding  a
	   random string to the conflicting name.  The disambiguating string
	   is of the form: "%xx" where "x" is randomly chosen from  the  set
	   "[0-9A-Za-z]". Eg., "foo-93-05-09-21:32:17%fQ".

	    On	short-filename	systems  (limited   to	 filenames   of   14
	   characters),  the  name  of	the  deleted  file is constructed by
	   truncating the original name to 11 characters,  and	appending  a
	   random  suffix  of  the form "%xx", as described above.  Deleting
	   the file "ThisIsALongFilename", with -s sequencing, could  create
	   the deleted file "ThisIsALong%8c".

      -t , --gracetime 
	   Files are kept a default of 3 days before permanent deletion.  If
	   the	[-t  ]  option  is  given  then  the  file will not be
	   permanently deleted for at least gracetime days, unless the	file
	   is  accessed during that time.  Reading an nrm'd file will update
	   its access time, thereby resetting its scheduled deletion date to
	   be the default number of days (3) in the future.

      -v, --verbose
	   Print the name of each file before removing it.  Unlike  GNU  rm,
	   the component files of a directory are not printed.

	   Print a usage message on standard output and exit successfully.

	   Print  version  information	on   standard	output	 then	exit

      Urm  is  used  to  restore  deleted  files  or   directories.    Given
      dirpath/basename	or  dirpath/.gone/basename  as	an argument urm will
      search for dirpath/.gone/basename and restore the file or directory if
      found.   The second form allows the user to give a command of the form
      urm foo/bar/.gone/* and have the shell do  wild-card  expansion.	 The
      modification time of restored files is preserved.

      Urm will ask before overwriting an existing file unless the -f  option
      is in effect.

      Alternatively, the files in .gone may be viewed  with  ls(1)  and  the
      desired  file  can be restored with mv(1) simply by moving it from the
      .gone directory to the desired location. When using  the	(-s)  option
      for  sequenced  backups,	manually  recovery  is advisable so that the
      desired sequenced version can be chosen.

      Nrm is a compiled program and does not use system(2) or exec(2) so  is
      significantly faster than similiar script-based implementations.

      When updating system executable files, using nrm	to  remove  the  old
      file  will prevent causing a "killed on text modification" swap error.
      The removed version will be permanently deleted gracetime  days  after
      the last process has ceased to swap to the removed file.

      This renaming strategy was used to  give a  good	summary  when  using
      du(1) to evaluate freed-up disk space.

      The -d and --directory options are implemented as synonyms for the -r,
      -R  and --recursive options to provide script-level compatibility with
      GNU rm(1).

      A line like the following should be added to root's crontab:

	   30 1 * * *	       /etc/nrm.cleanup

      The nrm.cleanup script permanently removes all empty  directories  and
      expired files.

      rm(1) unlink(2).

      Generally self-explanatory.  An attempt was made to provide  the	same
      exit  codes  and	user  interface as rm. Returns 0 if successful, 2 on
      errors.  It is forbidden to remove the file .. , the file  .  and  the
      files .gone/* . The -t option does not work on symbolic links.

      Rick Walker (

Rick Walker
walker "AT"