VMS-to-Unix Phrase Book
<=  Return           

2.5  Backup Files and File Versions

Problem

You want to have automatic backup versions of files similar to what VMS does automatically.

Solution

Use the Emacs editor which will do this automatically for you when editing files with Emacs.

Discussion

On approach would be to create shell scripts to extend all of the command Unix commands that you use to provide this feature. For example, you could write a script called vcopy which would make a new version of the destination file, much like the VMS copy command. This could be a good exercise for learning shell scripting. In the meantime, the Emacs editor will automatically create backup versions of any file you edit with that editor. To do this, create a file in your home directory named .emacs and insert the following code:

(setq version-control t)
(setq kept-new-versions 5)
(setq kept-old-versions 5)
(setq delete-old-versions nil)    ; ask before clobbering old versions
The first line turns on the numbered backup version feature. The remaining lines set limits to the number of files maintained and asking Emacs to prompt you before automatically purging back files according to these rules. This is some what analogous to setting the version limit for a directory, but these settings aer for all files you edit with Emacs, regardless of the file's location. In article 3.3 we also look at program that, as a motivation, implements a simple utility similar to VMS's purge command.

See Also

3.3 - Parsing Command Line Arguments;


<=  Return           

Colophon:
Best Viewed With Any Browser
This page maintained by:
    Bill.Costa@unh.edu
    of the Enterprise Computing Group
    in the dept of Computing & Information Sevices
    at the University of New Hampshire

Typographical
Conventions

Created:  31-Jan-2001 BC
Revised:  27-Mar-2001 BC