FSave A Program to Simplify Filesaves Shareware Version 1.0 Documentation Version 1.5 7/29/94 Copyright 1994 Kenneth A. Reek All Rights Reserved FSave is copyrighted software. It is not in the public domain, nor is it distributed for free. The author retains all rights to this software. FSave is distributed as Shareware so you can try it out without risk to see if you like it. Use it for two weeks. If you don't like it, simply delete it and owe nothing. If you continue to use FSave after the two week trial period, you must register your copy. The advantages of registration, a fee schedule, and a registration form may be found in the file "register.txt"; to register, fill out this form and mail it with your payment to the author: Kenneth A. Reek 3090 Griffin Rd Churchville, NY USA 14428-9512 Thank you for helping to make the ShareWare concept work. FSave Table of Contents 1 Preface ......................................................... 1 1.1 Printing this Document .......................................... 1 1.2 Preface to the Shareware Version ................................ 1 1.3 DISCLAIMER ...................................................... 2 2 Installation .................................................... 2 2.1 Where Do I Put It? ............................................. 2 2.2 Installing FSave ................................................ 2 3 A Quick Start ................................................... 2 3.1 Who Should Read This Chapter? .................................. 2 3.2 Step By Step Instructions ....................................... 3 4 Design Philosophy ............................................... 5 4.1 Why FSave? ..................................................... 5 4.2 FSave Design Principles ......................................... 5 5 Understanding Configurations .................................... 6 5.1 Overview of Operation ........................................... 6 5.2 Configurations .................................................. 6 5.2.1 Global and Local Configurations ................................ 6 5.2.2 Elements of a Configuration .................................... 7 5.2.3 Configuration Files ............................................ 7 5.3 Common Configuration Problems ................................... 9 5.4 An Example ...................................................... 9 6 FSave Operation ................................................. 13 6.1 Initialization .................................................. 13 6.2 Processing Files ................................................ 14 6.3 Processing Subdirectories ....................................... 15 6.4 Output Files .................................................... 15 6.5 Saving the Data ................................................. 16 6.6 The Initialization File ......................................... 16 6.7 Command Line Arguments .......................................... 19 6.8 Starting FSave .................................................. 21 6.9 Starting FSave from Windows ..................................... 22 7 Strategies for Using Configurations ............................. 22 7.1 The Root Directory .............................................. 22 7.2 Subdirectories .................................................. 23 7.2.1 Static Directories ............................................. 23 7.2.2 Dynamic Directories ............................................ 24 7.2.3 Static/Dynamic Directories ..................................... 24 7.2.4 The \windows Directory ......................................... 25 7.2.5 The \windows\system Directory .................................. 25 7.3 Testing Configurations .......................................... 26 8 Master Backups .................................................. 26 8.1 What Is a Master Backup? ....................................... 26 8.2 Creating a Master Backup ........................................ 26 1.5 - i - 7/29/94 FSave 8.3 Whole System Master Backup ...................................... 27 9 Restoring Files from Backups .................................... 28 9.1 Re-Deleting Deleted Files ....................................... 28 9.2 Directory Index ................................................. 29 9.3 Restoring Individual Files ...................................... 29 10 Incremental Backups ............................................. 29 10.1 Incremental and Delta Backups ................................... 29 10.2 Restoring from Incremental Backups .............................. 30 11 Alternate Configurations ........................................ 30 11.1 Specifying an Alternate Configuration ........................... 30 11.2 Using Alternate Configurations .................................. 31 12 Unix-Style Filename Patterns .................................... 31 12.1 Overview ........................................................ 31 12.2 Examples ........................................................ 32 1.5 - ii - 7/29/94 FSave 1. Preface Filesaves are a necessary evil on nearly all computer systems. Neces- sary because all systems (be it the hardware, the software, or the opera- tor) eventually fail resulting in loss of information, and evil because they are usually a pain in the neck to do. The problem is that filesaves must be done frequently, but are only needed infrequently. The natural human tendency in this type of situation is to put them off, but then when the failure occurs you don't have the up-to-date filesave that can save you. FSave is a program designed specifically for PC-type systems running either DOS or Windows that simplifies the task of creating filesaves. It does this by saving only that information that cannot be recovered from other sources. The result is that your periodic filesaves are quick and easy, and do not require expensive backup hardware (tape drives) or media (tapes). By making filesaves less onerous, FSave makes it more likely that you will do periodic filesaves more frequently than you otherwise would, for which you will be eternally grateful when your hard disk has crashed or you have lost data for another reason. Note that FSave itself does not do the actual archiving. Instead, it creates files containing lists of the names of the files that should be saved, and then invokes your favorite compressor/archiver program to do the grungy work. If your favorite archiver can be told to read a file to get the list of filenames to save, you can use it with FSave. This eliminates most religious arguments about the merits of the various compression pro- grams that are available. 1.1. Printing this Document If you wish to print this manual, you will get the best results by using an editor that prints exactly 66 lines per page. Of course, you can read it into a word processor and fiddle with it if have the time. 1.2. Preface to the Shareware Version The shareware version of FSave is missing some of the features found in the registered version. These missing features do not cripple the pro- gram or impair its basic functionality, so you will be able to fully test FSave to get a feel for how it works and whether you like it. The disabled features are what you might call "convenience features:" they don't perform any vital functions but they do make the program easier to use. This document describes the registered version of FSave. The symbol ($$$) is used to identify features which are missing in the shareware ver- sion. Note that this symbol is not a part of any command or keyword with which it appears; it simply flags something that has been disabled in the shareware version. 1.5 - 1 - 7/29/94 FSave 1.3. DISCLAIMER FSave is supplied as is. The author disclaims any and all warranties, expressed or implied, including but not limited to warranties of merchanta- bility and of fitness for any purpose. The author assumes no liabilities for any damages, direct or consequential, which may result from the use of FSave. 2. Installation Installation is easy, as there are only two files to copy. 2.1. Where Do I Put It? FSave can be put in a directory of its own, but it is more convenient to put it in a directory that is on your "PATH" because it can then be invoked without having to type its entire pathname. The installation pro- cedure below assumes that you will be installing it in the "c:\dos" direc- tory. If you wish to put it somewhere else, modify the commands below accordingly. 2.2. Installing FSave Follow these steps to install FSave: (1) Copy FSave into your "dos" directory with these commands: copy a:fsave.exe c:\dos\fsave.exe copy a:fsave.ini c:\dos\fsave.ini The "fsave.ini" file contains commands that use "pkzip" to do the archiving; if you wish to use another archiver, you must modify these entries. I suggest that you test FSave with "pkzip" first; if you like it, then invest the time to customize the initialization file. (2) Create a temporary directory called "c:\tmp". This is where FSave will write its lists of filenames and other reports. If you already have a temporary directory of a different name, edit "c:\dos\fsave.ini" and wherever "c:\tmp" appears, change it to the name of your temporary directory. (3) The next step is to create configuration files in your directories to indicate what should be saved and what should be skipped in each directory. Configuration files are completely described later in this manual; the next chapter will get you started. 3. A Quick Start 3.1. Who Should Read This Chapter? For the impatient types who would rather be doing something than read- ing about how to do it, here are some instructions to get you started quickly. But this glimpse of FSave's operation provides a good context in 1.5 - 2 - 7/29/94 FSave which to understand the remainder of this manual, so this chapter is worth reading even if you are the more patient type who does not need to see your machine busy doing something 24 hours a day. These instructions assume that you have "pkzip" version 2.04g or later, and that it is stored in a directory listed in your "PATH". If you do not have "pkzip" but would like it, it is available in shareware form from many bulletin boards and ftp sites. If you prefer to use a different archiving/compressing program, you will need to modify the commands in "fsave.ini" to invoke your chosen program. 3.2. Step By Step Instructions (1) Create a "configuration" file called "c:\fsave.cnf", containing these lines: DateAll = date SkipDirs = directory names SkipFiles = file names In the first line, enter the date you purchased your system (or the date you loaded your first software package) for the word "date". In the second line, type the names of all subdirectories in the root directory that you do NOT want to back up. This would include any temporary directories that do not contain any files of lasting value, and subdirectories that contain only files that can be recovered from other sources. This usually includes the "c:\tmp" directory. On the third line, type the names of any files in the root directory you do not wish to back up. These would include files that contain no useful information (e.g. the Windows swap file, though this is normally skipped because it is a hidden file), or files that can be recovered from other sources. If there are none, the entry may be omitted. Here is a typical root configuration file: DateAll = 1/1/93 SkipDirs = recovery tmp video bin There are more things that may be specified in configuration files, and they are fully covered in section 5. One final note: only files and directories in the current directory may be mentioned in a configuration file. To skip files or direc- tories contained in another directory, another configuration file is created in that directory. For example, to specify skipping the "windows\system" directory, "c:\windows\fsave.cnf" would include the line SkipDirs = system (2) Now change to the root directory and do a test-mode save, like this: cd c:\ 1.5 - 3 - 7/29/94 FSave fsave /t FSave will look through your entire "c:" drive (except the things you have told it to skip) to find all files that were last modified on or after the date you specified in your configuration file. A list of these filenames will be written to the file "c:\tmp\saved.txt"; each line of this file includes the size, modification date, and name of a file that would be backed up. Examine this list to find files that should not be backed up; any file that you can recover from any other source (bulletin board, distribu- tion diskette, master backup of that directory, etc.) need be backed up only if your file is newer than the version on the other source. In each directory containing files or directories that need not be saved, create a configuration file called "fsave.cnf" containing lines such as those shown above. Note that the entries in a configuration file are all optional; those that are not needed may be omitted. If all the entries are omitted, no configuration file is needed. The first thing to look for in each directory is whether a specific date marks the beginning of the files to be saved. If so, specify this date with "DateAll" in the directory's configuration file. Then, if there are subdirectories that should not be backed up, add their names to the "SkipDirs" entry in the configuration file. Finally, add the names of specific files that need not be saved to the "SkipFiles" entry. (3) After doing this for each directory that appeared in "c:\tmp\saved.txt", do another test save just like the first one. The "saved.txt" file will be recreated, and you can see the results of your efforts. If you find additional files or directories that need not be saved, add or modify the appropriate configuration files as needed to skip them. (4) When you have eliminated everything that can be eliminated, do a real filesave. The quick start initialization file specifies "pkzip" to create the backup files on "a:". If this is not appropriate for your system, modify the entries in "c:\dos\fsave.ini" as needed (you will need to look ahead to other sections of this manual to figure out what is needed). Then get a bunch of blank diskettes ready. How many will you need? That depends on what compression program you are using, and the specific contents of the files you are saving. With "pkzip", I regularly save 3 megabytes of information on a single 1.44 megabyte diskette. Start the filesave by typing cd c:\ fsave FSave creates one or more lists of files to be saved, and writes these lists to "a:" for future use as a table of contents. It then invokes "pkzip" to compress the files themselves to "a:". The initialization file provided specifies the "pkzip" option that continues a zip file on another diskette if the current one should fill up. 1.5 - 4 - 7/29/94 FSave (5) That's it - you've backed up your system. If your system is anything like mine, you needed to back up only a few megabytes out of many tens or perhaps hundreds of megabytes of stuff on your hard disk. (6) The hope is that you will never to restore files from a backup, but if the worst happens you will be prepared. After a failure, you would reload your operating system and all of your purchased or shareware software from their original media. Then you would restore the files FSave had saved to recover all of the information you had modified. 4. Design Philosophy 4.1. Why FSave? The are two main problems with doing filesaves on PC systems. The first is the large size of modern hard disks. Backing up a several hundred megabyte hard disk to 1.44 megabyte floppies is just not practical; it could easily take a hundred or more diskettes, not to mention many, many hours to do. The second problem is the price of tape backup hardware. Not everyone is willing to spend a couple of hundred dollars for a tape system capable of holding an entire hard disk's data. Just the tapes themselves can become a considerable expense. This is a high price to pay for something that, like insurance, you hope you never have to use. 4.2. FSave Design Principles FSave was designed around three basic principles. The first is sim- ple: If it is not quick and easy to do filesaves, you will do them less often than you should, maybe never. This fact of human nature is the challenge that FSave addresses: it makes filesaves much quicker and easier. How is this done? Quite simply, by not saving everything on the hard disk. The second basic principle is this: You will keep the media from which commercial or other software was originally obtained. The importance of this is easily explained: any files on your system that are unchanged since they were first installed need not be backed up regu- larly because they can be recovered from the original installation media. This is perhaps the one that is most likely to cause problems, but is also easily remedied. Programs downloaded from bulletin boards or ftp sites are often installed and then the downloaded file is discarded. If you can retrieve the program again later, then there is no problem (though 1.5 - 5 - 7/29/94 FSave keeping a list of which programs you have gotten and where you got them from will simplify this task). If for some reason you cannot get another copy of some program on your system, simply archive that entire directory to a diskette (or set of diskettes) and label that as a "master backup" (described more fully in a later chapter). Now, only those files that have changed since you created this backup need be saved regularly. The drawback to this approach is that restoring files after a crash is more time consuming. First, your operating system must be reloaded. Then, all your packages must be reloaded from their original media or master backups. Finally, your modified files are reloaded from your filesave diskettes. It is the third and final principle that makes this palatable: You will be backing your system up far more often than you will be restoring it. If this is not true of your system, FSave is not for you, but you should seriously consider getting a more reliable system. But if, like me, you have never had a hardware problem (knock on wood!) and need to restore files primarily due to occasional operator stupidity, then FSave will serve your needs perfectly. 5. Understanding Configurations 5.1. Overview of Operation FSave does a simple job: (1) it decides which files on your system need to be backed up, based on information obtained from your configuration files; (2) it writes the names of these files to one or more files in a temporary directory; and (3) it invokes a compressor/archiver program such as "pkzip" to actually save the files in each list to a diskette or other destination. 5.2. Configurations The foundation underlying this process is the "configuration"; it specifies which files to save and which to skip, and which directories to process and which to ignore. 5.2.1. Global and Local Configurations There are two configurations, the "global configuration" and the "local configuration." Only the local configuration determines what to save and what to skip in a directory; the local configuration gets its initial values from the global configuration. Here is exactly how this is done. When FSave enters a new subdirec- tory, the local and global configurations for that directory are both 1.5 - 6 - 7/29/94 FSave initialized from the parent directory's global configuration. The confi- guration file, if one exists in the directory, is then read; its contents may modify the local or global configuration. Modifications to the local configuration affect decisions about whether files in this directory should be saved or skipped. Modifications to the global configuration affect decisions about files in subdirectories of this directory. 5.2.2. Elements of a Configuration The local and global configurations contain the same things: one date, and six lists of file names or filename patterns. The date determines which files will be skipped; files whose modification times are earlier than this date are not saved. There are six filename lists that specify: (1) files to save, (2) files to skip, (3) files to delete, (4) files that should not be reported if they have been modified but were not saved, (5) subdirectories to process, and (6) subdirectories to skip. The redundant specification of files/directories to save and files/directories to skip makes configuration files easier to write; some- times it is more straightforward to list a few files to skip than it is to list all of the files to save. However, the redundancy allows for contrad- ictory specifications: what if the same name appears on the list of files to save and the list of files to skip? To eliminate this ambiguity, the "skip" lists take precedence over the "save" lists; a complete description of the manner in which the configuration is processed is given in a later chapter. 5.2.3. Configuration Files Every directory may contain a configuration file, though this is rarely needed because of the inheritance of configurations from the parent directory. Configuration files are usually named "fsave.cnf", but this may be modified through a command line option. Whatever their names, confi- guration files all contain one or more entries of the form: keyword = values The following keywords are provided: 1.5 - 7 - 7/29/94 FSave Date DateAll SaveFiles SaveAllFiles SaveDirs SaveAllDirs SkipFiles SkipAllFiles SkipDirs SkipAllDirs DeleteFiles ($$$) DeleteAllFiles ($$$) IgnoreUnsaved ($$$) IgnoreAllUnsaved ($$$) Each entry must be on its own line. Lines beginning with a "#" and blank lines are all ignored as comments. Configuration file entries are read without regard to capitalization, so "SaveFiles", "savefiles", "SAVEFILES", and "SaVeFiLeS" are all equivalent. Keywords listed in the left column above affect only the local confi- guration; those in the right column affect both the local and the global configurations. Because of this, the "All" entries usually appear first in configuration files, followed by the other entries. Date entries may be given in either of these forms: Date = mm/dd/yy Date = mm/dd/yyyy Two-digit years 80-99 are interpreted as 1980-1999, with 00-79 being inter- preted as 2000-2079. Four digits may be used to specify any year from 1980 to 2108, the range of dates allowed by MS-DOS. The values for all other entries are given as a list of zero or more (yes, the list may be empty) Unix-style filename patterns, separated from each other by one or more spaces and/or tabs. These Unix-style patterns are more powerful than MS-DOS filename patterns, and are fully explained in the last chapter. It suffices here to say that most MS-DOS patterns will work exactly as you expect them to; the major incompatibility is with the "?" character, which in a Unix-style pattern always matches exactly one character. Of course, full filenames and directory names may also be given in filename lists. However, the entries in a configuration refer only to the files and subdirectories contained in that directory, so filenames or pat- terns containing "\" will have no effect and should not be used. With all except the Date entries, the "=" may be replaced with either "+" or "-". Using "=" sets the list to the given values, using "+" adds the given values to the list, and using "-" removes the given values to the list. Adding something that is already on a list has no effect, and trying to remove something that is not on a list is silently ignored. Finally, a configuration file may contain several entries with the same keyword, and the entries in a configuration file are processed in the order in which they appear. This means that SaveAllFiles = *.cpp 1.5 - 8 - 7/29/94 FSave SaveAllFiles + *.h has the same effect as SaveAllFiles = *.cpp *.h But be careful, if you do this: SaveAllFiles = *.cpp SaveAllFiles = *.h the second entry replaces the value set by the first entry. 5.3. Common Configuration Problems Here are some common mistakes that people make in configuration files. (1) The All entries modify both the global and local configurations, which leads to this common error: SaveFiles = *.exe SaveAllFiles = *.txt In this example, the first line does not accomplish anything. It sets the local configuration, but the second line also sets the local con- figuration, replacing the value given in the first line. The solu- tion: put the All entries before other entries in your configuration files. (2) Using the equal sign replaces the old list with the newly specified list. For example, if the configuration file in the parent directory specified a bunch of different kinds of files to save, the configura- tion SaveFiles = *.exe discards all of that and specifies that only files ending with exe should be saved. If that is really what you want, there is no prob- lem. If what you wanted to do was to _a_d_d this to the list given in the parent directory, this is not the way to do it. The solution: use the plus to add new things to an existing list. 5.4. An Example The listings and files below come from my own system, and are presented as an example of one way that FSave can be used. To keep things to a manageable size, only a subset of my whole disk is shown. The direc- tory listings were all made with the command "dir/o:d" which orders the entries by their date. 1.5 - 9 - 7/29/94 FSave The root directory looks like this: Directory of C:\ WINA20 386 9349 05-09-91 12:00p RECOVERY 08-25-92 12:00p DOS 08-25-92 12:00p PS1TOOLS 08-25-92 12:00p WINDOWS 08-25-92 12:00p MSWORKS 08-25-92 12:00p QUICKENW 01-24-93 11:03a BIN 02-02-93 6:02p USR 06-07-93 9:56a SRC 12-24-93 3:33p CONFIG SYS 191 12-30-93 3:06p PROFILE SH 387 01-22-94 9:59p VIDEO 01-29-94 8:17a BC4 05-19-94 10:59a AUTOEXEC BAT 759 05-19-94 11:40a FSAVE CNF 109 05-20-94 6:45a TMP 05-28-94 7:57a My configuration in this directory looks like this: DateAll = 1/1/93 SkipDirs = recovery tmp video IgnoreUnsaved = 386spart.par I chose the date because that is when I purchased the system; everything that was on the system when I bought it can be recovered from the diskettes that came with it, so there is no need to back up any of it. I do not back up the directories "recovery" and "video" because they do not contain any- thing that ever changes. I do not back up the directory "tmp" because I never put anything of lasting value in it; that is my "scratchpad" direc- tory. Let's look next at the "QUICKENW" directory, which contains an installed package. Directory of C:\QUICKENW HMXPORT DLL 8256 11-13-92 10:17a QDDE XLS 4898 11-13-92 10:18a QDDE WK3 9651 11-13-92 10:18a INTELLIC CAT 12619 09-07-93 12:00a QCHECK EXE 9344 09-07-93 12:00a CCT100 DLL 222032 09-07-93 12:00a QWPR DLL 253696 11-03-93 2:51p WPRINTCK EXE 61718 12-09-93 12:00a QW EXE 2256256 12-09-93 10:47a QW HLP 1561240 12-09-93 10:47a QOWPR DLL 252000 12-09-93 10:48a QOFONT FON 4096 12-09-93 10:48a 1.5 - 10 - 7/29/94 FSave BACKUP 05-01-94 10:12a FSAVE CNF 20 06-06-94 9:53p QDATA QNX 92982 07-27-94 9:12a QDATA QDI 5192 07-27-94 9:12a QDATA QDT 484736 07-27-94 9:14a QDATA QMT 31236 07-27-94 9:14a This is not a complete listing, but is enough to be representative. When I installed this package, the latest date appearing in the directory was 12/9/93. Therefore, the configuration file in this directory contains only this line: DateAll = 12/10/93 This prevents anything from the original installation (which could be recovered by re-installing the package) from being backed up. Any files that are _m_o_d_i_f_i_e_d will have dates later than this, and they will be backed up. In the preceding example, the "QUICKENW" directory contained a sub- directory called "BACKUP". Its contents are shown below: Directory of C:\QUICKENW\BACKUP FSAVE CNF 18 05-01-94 10:14a QDATA1 QNX 92982 07-27-94 9:12a QDATA1 QDT 484736 07-27-94 9:12a QDATA1 QMT 31236 07-27-94 9:12a QDATA1 QDI 5192 07-27-94 9:12a QDATA1 QST 39505 07-27-94 9:12a Quicken periodically copies its data files to this directory as a safety measure. I don't particularly like this, as I back the files up to flop- pies as often as I think is necessary; as far as I am concerned, this backup directory simply wastes disk space. Therefore, the configuration file in this directory specifies this: DeleteFiles = *.q* so that FSave will automatically delete all the quicken files in the backup directory. Here is one final directory, called "SRC"; this is where I keep the source code to programs that I write (such as FSave). Directory of C:\SRC CRYPTO 01-04-94 8:32p UTILITY 01-05-94 8:01p FINDSYM SH 270 01-30-94 11:40a WENSCRIP 02-20-94 6:26a TIMECLK 02-25-94 1:34p DU 02-27-94 12:50p 1.5 - 11 - 7/29/94 FSave LIB 03-03-94 7:38a BC4ERRAT TXT 241 04-08-94 5:34p CLASSLIB 04-24-94 2:40p FSAVE 04-30-94 10:51a CLEANSRC SH 1062 06-28-94 6:21p FSAVE CNF 126 06-28-94 6:21p The configuration file for this directory contains these entries: SkipAllFiles = *.dsw *.exe DeleteAllFiles = *.~* *.obj *.csm *.bak DeleteAllFiles + *.map *.rws *.res *.obr IgnoreAllUnsaved = *.dsw Files with extensions "dsw" and "exe" are not backed up; the former are not terribly important, and can be recreated with little trouble if they are lost. The latter are executable programs. The only executables in these directories are the ones generated from the source code, so they exist there only while being tested. A large number of file types are deleted: these are all backup files created by the compiler, or things such as object code or linker maps that have no long-term value. Finally, the last entry specifies that the "dsw" files which were skipped should not be reported in the "unsaved.txt" file, as I don't care about them anyway. A test-mode filesave on these directories produced the following results. Again, I have deleted many entries, especially those from direc- tories other than the ones discussed above, but have left enough to show a representative sampling. The following files were selected to be saved: 191 12/30/93 CONFIG.SYS 387 01/22/94 PROFILE.SH 1,371 07/27/94 HISTORY.SH 109 05/20/94 FSAVE.CNF 759 05/19/94 AUTOEXEC.BAT 92,982 07/27/94 QUICKENW\QDATA.QNX 484,736 07/27/94 QUICKENW\QDATA.QDT 31,236 07/27/94 QUICKENW\QDATA.QMT 5,192 07/27/94 QUICKENW\QDATA.QDI 20 06/06/94 QUICKENW\FSAVE.CNF 18 05/01/94 QUICKENW\BACKUP\FSAVE.CNF 241 04/08/94 SRC\BC4ERRAT.TXT 1,062 06/28/94 SRC\CLEANSRC.SH 270 01/30/94 SRC\FINDSYM.SH 126 06/28/94 SRC\FSAVE.CNF 718 06/25/94 SRC\FSAVE\PERRNO.CPP 411 06/25/94 SRC\FSAVE\PERRNO.H 9,592 07/27/94 SRC\FSAVE\FSAVE.CPP 1,380 05/20/94 SRC\FSAVE\CONFIG.H 7,862 07/27/94 SRC\FSAVE\CONFIG.CPP 77,206 07/27/94 SRC\FSAVE\FSAVE.IDE (and many more) 1.5 - 12 - 7/29/94 FSave 354 files (2,921,018 bytes) to be saved. The following files would have been deleted: 92,982 QUICKENW\BACKUP\QDATA1.QNX 484,736 QUICKENW\BACKUP\QDATA1.QDT 31,236 QUICKENW\BACKUP\QDATA1.QMT 5,192 QUICKENW\BACKUP\QDATA1.QDI 39,505 QUICKENW\BACKUP\QDATA1.QST 9,556 SRC\FSAVE\FSAVE.BAK 7,883 SRC\FSAVE\CONFIG.BAK 2,128,147 SRC\FSAVE\FSAVE.CSM 78,074 SRC\FSAVE\FSAVE.~DE 64,598 SRC\FSAVE\CONFIG.OBJ 75,608 SRC\FSAVE\FSAVE.OBJ 13,389 SRC\FSAVE\PERRNO.OBJ 112,021 SRC\FSAVE\FSAVE.MAP (and many more) 31 files (6,283,049 bytes) to be deleted. The quicken backup files would be zapped, as well as over 5 megabytes of other garbage. Finally, the following files were reported as having been modified yet not saved: 115,608 07/27/94 SRC\FSAVE\FSAVE.EXE 42,496 07/18/94 SRC\WENSCRIP\WENSCRIP.EXE 2 modified files unsaved. These executables in the source directory exist only for testing, so they do not concern me. If I wanted, I could add the pattern "*.exe" to the "IgnoreAllUnsaved" line in the "SRC" directory's configuration file to eliminate these messages. 6. FSave Operation 6.1. Initialization When FSave begins, it first reads an initialization file called "fsave.ini". This file contains several things that affect the operation of FSave, for example, (1) the command to invoke to actually save a list of files, and (2) the directory in which to write lists of filenames. The format of the initialization file is completely described later in this chapter. FSave then reads its command-line arguments. These may contain options that select different modes of operation or modify how configura- tions are interpreted. The options are followed by zero or more directory names, these are specific subdirectories in which to begin working. If no directory names are given, work begins in the current directory. The 1.5 - 13 - 7/29/94 FSave available options are completely described later in this chapter. FSave then sets the local and global configuration to the following default values: DateAll = 1/1/1980 SaveAllFiles = * SaveAllDirs = * SkipAllFiles = SkipAllDirs = DeleteAllFiles = IgnoreAllUnsaved = This will save all files on the disk, as 1/1/1980 is the earliest date that MS-DOS can store on a file. Normal processing now begins; it consists of the following three steps: (1) If a configuration file is found in the current directory, read it. (2) Process each file found in the current directory. (3) Recursively process each subdirectory found in the current directory. 6.2. Processing Files "Processing" a file is simply comparing its name and modification date to the local configuration to decide whether it should be saved. Here are the steps in this process: (1) If the name matches any pattern in the "DeleteFiles" list, the file is deleted. (2) If the modification date of the file is older than the "Date", the file is skipped (i.e. not saved). (3) If the filename matches anything on the "SkipFiles" list, the file is skipped. (4) If the filename does not match anything on the "SaveFiles" list, the file is skipped. (5) If the file has not been deleted or skipped, its name is added to the list of files to be saved. The default configuration makes use of one common strategy of specify- ing files to be saved: the "Save" list says to save everything, and we rely on the "Skip" list to omit those files we do not want. The other strategy is for the "Save" list to enumerate only those files we want saved; some- times this is easier to specify. 1.5 - 14 - 7/29/94 FSave 6.3. Processing Subdirectories After the files in a directory have been completed, the subdirectories are processed. "Processing" a subdirectory involves matching its name against the configuration; FSave enters each directory that is not skipped and processes its contents recursively (that is, in the same way that first directory was processed). Here are the steps followed for a subdirectory: (1) If the subdirectory name matches anything on the "SkipDirs" list, it is skipped. (2) If the subdirectory name does not match anything on the "SaveDirs" list, it is skipped. (3) If the subdirectory has not been skipped, then it is recursively pro- cessed. Directories that are "skipped" are truly ignored by FSave. It makes no difference whether they contain configuration files that specify work to be done; if they are skipped, these configuration files are never acted upon. 6.4. Output Files FSave writes all of its output files in the temporary directory speci- fied in the initialization file. These files include the following: fsave1.txt, fsave2.txt, etc. These files contain lists of the names of files that need to be saved. There may be many of them because some archiving programs impose a limit on the size of list files. When the current list file exceeds the "FileSize" given in the initialization file, then FSave closes it and begins the next sequentially numbered list file. saved.txt When operating in "test mode", FSave creates one large list file that also includes the size and modification date of each file. Examine this file to see what is going to be backed up; this is the first step in figuring out appropriate configurations. unsaved.txt If enabled in the initialization file, FSave will record in this file the names, dates and sizes of all files whose archive bit is on but that were not saved. This is a dangerous combination - the archive bit shows that the file has been modified, therefore it cannot be recovered from the installation media, yet it was not saved. This may indicate that the configuration file needs to be changed. On the other hand, there are files for which this is not a problem. For example, object files produced by compiling source code need not be backed up if you have the source files. Patterns can be added to the "IgnoreUnsaved" list in the configuration to prevent FSave from 1.5 - 15 - 7/29/94 FSave yelling about these files every time. Note that FSave does not report unsaved/modified files residing in directories that have been skipped. To detect these, run FSave like this: fsave /a ($$$) (Remember that the ($$$) symbol denotes features disabled in the shareware version.) This option is described in more detail below; briefly, it instructs FSave look for all files whose archive bit is set, even if they would normally not be saved or reside in directories that would normally be skipped. Doing this just after an ordinary filesave will produce a list of all modified but unsaved files on the disk. deleted.txt ($$$) If enabled in the initialization file, FSave will record in this file the names and sizes of all files it has deleted. This information is useful when running FSave in test mode after modifying configurations to ensure that you have not been too aggressive in specifying "DeleteFiles". 6.5. Saving the Data After creating the lists of names of files to be saved, FSave then invokes your chosen archiving/compression program to actually save the files. The current version of "pkzip" (2.04g) is unable to process lists of filenames which are longer than several thousand bytes, so FSave writes as many short list files as needed to hold the names of all the files to be saved. This causes an irritating problem when the archives are actually being created for backups that take more than two diskettes. What happens is that "pkzip" is invoked separately for each list file, so when a diskette becomes full, "pkzip" has no way of knowing how many diskettes were used by the previous archive files. It therefore prompts you to insert diskette #2 _e_v_e_r_y time it needs a new diskette, which can be confus- ing if you are not expecting it. A representative of PKWARE has informed me that the next version of "pkzip" will be able to handle much larger list files, which will make this problem much less annoying. If you can afford the luxury of writing your backups to your hard disk rather than to floppy disks, this problem goes away. In addition, restor- ing files becomes easier as there is never any confusion as to which floppy to insert. 6.6. The Initialization File The initialization file specifies values that affect the general operation of FSave. By default this file is named "fsave.ini" and resides in the same directory as "fsave.exe"; if you prefer to use a different name, or keep the file in a different directory, you may set an environment 1.5 - 16 - 7/29/94 FSave variable called "FSAVE" with the absolute pathname to the initialization file. This file begins with a line containing "[fsave]" followed by one or more of the following entries: ConfigName = value ($$$) Indicates the default name of the configuration file. If not given, the value fsave.cnf is used. The extension .cnf may not be changed. If you prefer your configuration files to appear either first or last in a sorted directory listing, you may use this option to modify the name appropriately (e.g. 000fsave.cnf). ConfirmDelete = value ($$$) Indicates whether a confirmation is needed before deleting files as specified by the configuration. The value may be either "yes" or "no", with the default being "yes." If this option is selected, FSave will prompt with the name of each file it is about to delete; if the reply does not begin with "y" or "Y" the file will not be deleted. DirectoryIndex = value ($$$) Specifies whether an index of the files in each directory should be created and saved along with the files. The value may be either "yes" or "no", and defaults to "no." The directory index allows you to easily find what has changed in a directory since the last backup. It is also useful after restoring from a backup to remove files that had been deleted before the filesave was made. This option is discussed in more detail in a later chapter. Dump = (command) IncrementalDump = (command) These entries are required, and specify the MS-DOS command to be exe- cuted to archive the files whose names appear in a list file. The name of the list file can be referenced in the command by the con- struct "%list%", and the number of the list file can be referenced by "%number%". The number refers to the sequence number of a list file, e.g., 1 for "fsave1.txt", 2 for "fsave2.txt", etc. The examples below are from the quick start initialization file provided on the distribu- tion diskette, and use "pkzip". Dump = pkzip a:\fsave%number% -ex -P -r- -whs -& -a+ @%list% IncrementalDump = pkzip a:\fsave%number% -ex -P -r- -whs -& @%list% These both create compressed archives on the "a:" diskette; the archive files are named "fsave1.zip", "fsave2.zip", and so forth; max- imum compression is used; the complete pathname for each saved file is kept; subdirectories are not recursively processed (because FSave does that); "hidden" and "system" files (if selected by FSave) are also saved; the zip files may span multiple diskettes; and the names of the files to save are taken from "fsave1.txt", "fsave2.txt" and so forth in the temporary directory. The only difference between the two com- mands is that the archive bits of the saved files are not turned off after an incremental dump. This is a personal preference whose 1.5 - 17 - 7/29/94 FSave ramifications are discussed more fully in a later chapter. FileSize = nnn If given, this entry limits the size of the files containing the list of names to back up to the number of bytes specified. Once a list file goes over this size, a new one is started. For example, "pkzip" cannot process list files that are larger than a certain maximum size. "nnn" represents an integer byte size. If omitted, the list file is not limited in size. Example: FileSize = 5000 ReportDeleted = value ($$$) ReportUnsaved = value ($$$) These entries specify how you want FSave to report files that have been deleted, and files that were not saved though they have been modified. "value" may be any of the following: none No reporting is done. file Report to a file (default). screen Report to the screen. both Report to a file and the screen Report files are written in the temporary directory, and are named "deleted.txt" and "unsaved.txt" respectively. When not in test mode, the report of deleted files is usually of academic interest (how much disk space did it reclaim?), but the report of modified-but-unsaved files can point out files that ought to be saved but are not. This file should be examined often to see whether the addition of new files has required a change in a configuration. ($$$) The shareware version does not delete files, so none are reported. Reporting of unsaved files is limited only to the "file" type. SaveHidden = value ($$$) This entry specifies whether hidden, system, and read-only files should be examined by FSave. "value" may be either "yes" or "no"; the default value is "no", meaning that these files are always skipped. If "yes" is specified, then these files will be saved if they meet whatever other criteria are given in the current configuration. SaveList = (directory) If given, this entry specifies a directory to which the list files should be copied before the archiving takes place. This provides a convenient way to copy the list files to the archive media itself, where they can be used as a table of contents later if individual files must be retrieved. "(directory)" is an absolute pathname. The example below is used with the dump commands above, that write their output to "a:". 1.5 - 18 - 7/29/94 FSave SaveList = a:\ SwitchChar = value ($$$) This determines which character is used on the command line to indi- cate options. The value may be either "/" or "-", and defaults to "/". Temp = (directory) Specifies a temporary directory in which the list and report files are written. This should probably not be a directory that you are backing up. "(directory)" is an absolute pathname. If the entry is not given, "c:\tmp" will be used. Example: Temp = d:\temp 6.7. Command Line Arguments There are many command line arguments that can be given to modify how FSave does it work. Any number of these may be used on the command line when FSave is invoked. Options are introduced with either the "/" character, unless "fsave.ini" specifies that "-" be used instead. The options are listed alphabetically below. /a ($$$) Starting at the current directory, find all files whose archive bit is set and record their names and sizes in the "unsaved.txt" file. /c Causes the configuration to be printed on the screen for each sub- directory processed. This is useful in debugging your configuration files, although it does generate much output when FSave looks at the whole disk. /d ($$$) This is "delete mode" - FSave scans the directories it normally would, but all it does is to delete the files specified in the configura- tions. This is a convenient way of cleaning the litter off your disk when space starts getting tight. /D mm/dd/yyyy /D mm/dd/yy Overrides the date set in the configuration files with the given date. This may be used to create a master backup of a specific directory to reduce the amount of data that must be saved in an ordinary filesave. /f name ($$$) The default base name for the list files is "fsave", unless a dif- ferent value was specified in the initialization file with the "Con- figName" ($$$) entry. This option overrides that and allows a dif- ferent base name to be specified. The base name should be short 1.5 - 19 - 7/29/94 FSave enough to allow the list file number to be appended to it. For exam- ple, if your backup requires fifteen list files, the maximum length allowed for the base name would be six characters. This is useful to store many small backups on the same diskette. /i This does an "incremental" backup. Files are selected according to the configuration as usual, except only those whose archive bit is set are added to the list of files to be saved. The default is to back up all files that match the configuration criteria, whether or not their archive bit is set. Full and incremental backups are discussed more fully in a later chapter. /n name ($$$) /N name ($$$) These options specify the name of the configuration file to use when an alternate configuration is desired. The suffix ".cnf" is appended to the given name. If "/n" is used, only configuration files with the specified name will be read. If "/N" is used, FSave attempts to read a configuration file with the specified name; if none is found, the default configuration file is read instead. /o number ($$$) This option overrides various aspects of the configuration files. The following numbers are implemented: 1 Save files even if their modification dates are earlier than the configuration. 2 Save files even if their names match a pattern in the "Skip- Files" list. 4 Save files even if their names match a pattern in the "Skip- Files" list, OR if their names do not match any pattern in the "SaveFiles" list. 8 Recursively process subdirectories even if their names ap- pear in the "SkipDirs" list. 16 Recursively process subdirectories even if their names ap- pear in the "SkipDirs" list OR if their names do not match any pattern in the "SaveDirs" list. 32 Do not delete files specified in the "DeleteFiles" list. 64 Do not create a "saved.txt" or the "fsave1.txt" files. This means that nothing will be backed up. 128 Do not create an "unsaved.txt" file, despite what the ini- tialization file indicates. 256 Do not create a "deleted.txt" file, despite what the ini- tialization file indicates. 512 Invert the meaning of the configuration date, that is, save only files whose dates are earlier than the configuration date. 1024 Ignore the "IgnoreUnsaved" list; report all unsaved modified files in the "unsaved.txt" file. 1.5 - 20 - 7/29/94 FSave More than one of these overrides may be specified by adding their numbers together. For example, /o 7 specifies the first three overrides. Alternatively, you may give mul- tiple "/o" options on the command line: /o 1 /o 2 /o 4 also specifies the first three overrides. /t This is the "testing" mode. FSave creates the list of files to be saved in a file "saved.txt" in the temporary directory, but does not invoke the archiving program to save them. In addition, the size and modification date of each file are also written to the file, allowing you to discover files that should not be saved so that you can modify the configuration accordingly. Unsaved files are reported normally as well. 6.8. Starting FSave By default, FSave begins its work in the directory from which it is started; pathnames for saved files are given relative to this starting directory. The normal way of running FSave is from the root directory of your hard disk, like this: cd c:\ fsave You may also start FSave from a subdirectory, like this: cd c:\quickenw fsave The directory from which FSave is started will be treated as if it were the "root" directory; specifically, pathnames for saved files will be given relative to it, and the configuration files in parent directories will not be processed. Sometimes this is useful, for example, to create a master backup of a specific directory without regard to the dates of its files. The third way of starting FSave is from the root directory, but with pathnames to one or more specific subdirectories given as arguments after the options, like this: cd c:\ fsave quickenw For each pathname given, FSave starts with its default configuration, reads the configuration files in each subdirectory on the way down to the speci- fied one, and then begins operating in that directory. Pathnames of saved files will be given relative to the target directory. The difference 1.5 - 21 - 7/29/94 FSave between this method and the second method above is that the configuration information developed from the root down to that directory is processed. 6.9. Starting FSave from Windows Once you have finalized your personal filesave procedure, you can avoid the need to open a DOS window by starting FSave directly from Win- dows. This is easily done with these steps. (1) Copy the batch file "wfsave.bat" and the icon "fsave.ico" to the same directory in which you put "fsave.exe". The batch file contains these commands: @echo off rem Batch file to run fsave.exe from Windows fsave %1 %2 %3 %4 %5 %6 %7 %8 %9 pause (2) Now go to the Program Manager and select "File|New", then select "Pro- gram Item" and click "OK". Enter "Filesave" for the description, "wfsave.bat" for the command line, and "\." for the working directory. You may use the icon in "fsave.ico" if you wish. Then click on "OK". (3) To do a filesave, simply double-click this item in the Program Manager. If Windows complains that it cannot find "wfsave.bat" you will need to use "File|Properties" and change the command line to include the complete pathname to it. The "pause" command in the batch file allows you to read the results of FSave before the DOS screen disappears. The batch file can be invoked with different arguments; for instance you can create another program item whose command line is wfsave.bat /t to do a test save, and a third whose command line is wfsave.bat /a ($$$) to look for modified but unsaved files. 7. Strategies for Using Configurations With its default configuration, FSave will save everything on the disk. The name of the game is to create configurations that prevent any files from being saved that could be recovered from other media. 7.1. The Root Directory The quick start chapter illustrated the most basic strategy: the con- figuration file in the root directory specifies an overall date for the system. On many PCs, using the date that the machine was purchased is a 1.5 - 22 - 7/29/94 FSave good start, as the software that came with the machine is obviously older than that. Of course this implies that you still have the diskettes from which that software was loaded. If you do not, or if your machine came with preloaded software and you have no backup media, you will have to create a master backup. This process is described in more detail in a later chapter. In addition, the configuration file in the root directory can mention any specific files or directories that need not be saved. For example, the configuration file in the root directory on my hard disk looks like this: DateAll = 3/1/93 SkipDirs = tmp video This indicates that no files dated earlier than 3/1/93 should be saved; "DateAll" was specified so this date applies in this directory and all sub- directories (until overridden by another configuration file in a subdirec- tory somewhere). I also have specified that the directories "tmp" and "video" are to be skipped; this is because "tmp" is a temporary directory that contains only scratch files, and nothing in "video" ever changes. Note that these names were specified in the local configuration only, so they apply only to this directory. Once FSave enters a subdirectory the specification to skip "tmp" and "video" is discarded. On the other hand, the keyword "DateAll" put the date in the global configuration, so it is carried into all subdirectories until modified by another configuration file. 7.2. Subdirectories The type of configuration needed in a subdirectory depends upon how the files that it contains are used. Several possibilities are discussed below; there are probably additional cases that I've missed, but these examples should be enough to give you ideas for handling other types of directories. 7.2.1. Static Directories Some directories contain files that simply never change, or that change only trivially. Here, "trivially" means that the changes are unim- portant; if the file were lost, a restored copy of the file in its original form would be perfectly acceptable. Directories such as these can simply be skipped. Be very sure, though, that any modifications that subsequently occur to files in the directory are indeed trivial as described above. You might ask, "What harm is there in FSave looking through this directory - if nothing is saved, it costs little to look." This is true, and it is easy to argue that this approach is safer as well; should a file in this directory change unexpectedly, then it will be saved. 1.5 - 23 - 7/29/94 FSave It does take a small amount of time for FSave to process a directory. A bigger cost, though, is that the directory index (described fully in a later chapter) that must be created, backed up, and then deleted. For a directory that truly has no activity, this effort is wasted. FSave allows you to specify whichever option you think is best. 7.2.2. Dynamic Directories If a directory contains files that are all constantly changing, then everything in the directory should be saved. This is easily accomplished by setting the configuration date to 1/1/80 (or any date earlier than the oldest file you wish to save). 7.2.3. Static/Dynamic Directories These previous two cases are easy to handle; these dirctories are more interesting. Some directories contain files that are constantly being modified and files that never change. A directory that contains a software package probably contains files that are unchanged since the installation and files that are modified every time the package is used. The straightforward approach to configuring these directories is to specify a date that is later than any of the unchanged files but before all of the modified files. In principle, there may be overlap between these date ranges, but this rarely occurs in practice. The obvious choice for this date is the day after you installed the software: anything you have changed since the installation cannot be dated before the installation. If portions of the software or its data files reside in subdirectories, setting the global date in the configuration of the main directory causes it to be used in each subdirectory as well. For many directories, this is all that will be needed. Things become more interesting when updates are applied to the pro- grams in such a directory. After being patched, the modified programs will have dates that are more recent than many data files that are being saved. The question is, do you want to save the modified program? It depends. Suppose you don't want save the program. This can be accomplished by changing its date with the "setftime" ($$$) utility included with FSave, or by changing the date in the configuration file. Should you need to reload it later, though, the program will have to be patched again so you must save the patch information and take the time to apply the patch again after reloading. However, the filesave remains small and fast because this program does not get saved each time you back up your system. On the other hand, suppose you do want to save the program. The filesave gets larger and slower, but it is easier to restore the program if you need it because the patched version was being saved all along. The problem is that the filesave, which occurs frequently (we hope), becomes less convenient to make restoring the file, which occurs infrequently (we 1.5 - 24 - 7/29/94 FSave hope!) more convenient: this is backwards. There is a simple compromise between these extremes. First, set the date in the configuration file as you normally would to ensure that your modified files are saved. Then, when the amount of data being saved from the directory grows enough to justify the effort, make a master backup of everything in the directory. Then change the date in the configuration file to be the day after you created the master backup. By taking the time to back up the entire directory once, your periodic filesaves become quicker and easier because only the files changed since you created your master backup will be saved. Later, when an inordinate amount of data is again being saved from this directory, a new master backup can be created and the process starts anew. 7.2.4. The \windows Directory The "\windows" directory is an example of a static/dynamic directory: it contains program manager group files that change almost constantly; ini- tialization files that change, some frequently and some less frequently; and executables and other files that change rarely, if at all. It is tempting to classify changes to the program manager files and initializa- tion files as trivial and skip this directory, but I prefer to back it up: the amount of data is small enough that it is not a bother, and I won't have to go through each of my applications after reloading and get them all set up again. 7.2.5. The \windows\system Directory Interestingly, the "\windows\system" directory is a different story. The files it contains (device drivers and dynamic link libraries) do not change, while new files may be added to the directory every time a new package is installed. The difficulty here is that the newly installed files may be dated months or years in the past, making it impossible to use dates to discriminate between "old, unmodified" files and "new, changed" files. One approach to this dilemma is to skip the directory completely. After all, it can be reconstructed by reloading the original operating sys- tem and then reloading each application one by one. On the other hand, suppose you accidentally deleted just this one directory. You would prob- ably not be thrilled by the prospect of reloading all of your software (and possibly reapplying patches) just to recover the contents of the "\windows\system" directory. A more conservative strategy is to create a master backup of this directory (which is unpleasant due to its size), and clear the archive bits of all files in the directory. Then periodically examine it to see what files have been added or changed. Imagine having to reload all of the software packages (and reapply whatever patches are appropriate) to which these files belong: when this prospect begins to make you shudder, create a new master backup. Again, you cannot rely upon modification dates for this directory because files added to the directory during a software 1.5 - 25 - 7/29/94 FSave installation might have any modification date. 7.3. Testing Configurations The test mode of FSave provides a quick and easy way to see the results of new or modified configurations. Simply examine the "saved.txt" and "unsaved.txt" files to see which files are saved and the modified files that are not saved. If you think that FSave is not saving the files you specified, try checking your configuration with the "/c" option. This causes the confi- guration to be printed for each directory FSave processes; by examining the progression of configurations from the root directory to the one in which the problem is occurring, you can locate the erroneous configuration file. 8. Master Backups 8.1. What Is a Master Backup? What is a "master backup", how do you create one, and why would you want to create one? Simply stated, a master backup is a backup of all of the files in a particular directory. The interesting part of this is the word "all", as you shall soon see. Why would you want such a thing? A master backup can serve as a replacement for the installation medium for software whose original diskettes have been lost, damaged or discarded. Additionally, creating a master backup reduces the amount of data that must be saved in your periodic filesaves. After creating the master backup, the date in the con- figuration for the directory can be changed to the day after the master backup; only files modified after the master backup need be periodically saved. 8.2. Creating a Master Backup A master backup can be created in either of two ways. The easiest way is to simply use "pkzip" (or your favorite compressing/archiving program) in its usual way to save everything in the directory. This is easy, but has the disadvantage of including all files in the backup. Now I can hear you saying, "but the whole point was to get all the files!" True, but if the directory contains large data files that are frequently modified and thus will be saved in your ordinary filesaves, you may find it more con- venient to omit them from the master backup to reduce its size. A slightly more involved method way is to create the master backup using FSave. Special options are used to override the configuration in the directory. For example: cd c:\quickenw fsave /D 1/1/80 will save files in the "quickenw" directory regardless of date. If the configuration in this directory specifies files to skip, you may prefer to 1.5 - 26 - 7/29/94 FSave use cd c:\quickenw fsave /D 1/1/80 /o 4 which will save files even if they appear in the "Skip" list or do not appear in the "Save" list. If the directory contains subdirectories that should be on the master backup but are skipped by the configuration, the following commands would be used: cd c:\quickenw fsave /D 1/1/80 /o 16 Another alternative is to set the date in the configuration file to today's date, and then use this command: fsave /o 4 /o 16 /o 512 Besides saving files and directories regardless of the "Save" and "Skip" lists, this command inverts the meaning of the configuration date, so FSave backs up only those files whose date is earlier than the configuration. Now an ordinary filesave will back up all the remaining files, so between the master backup and an ordinary backup every file has been saved. Here is another technique that can be useful. Create an alternate configuration file (see chapter 11) containing the date that separates files unchanged since they were installed from the files that have been modified, and use this to create the master backup. Then set the date in the regular configuration file to the day after the master backup was created. Your regular filesaves will back up only those files changed since the master backup was taken, but the master backup itself will be shorter because it will not include any files which can be recovered from the original distribution media. 8.3. Whole System Master Backup This final technique will appeal to those who are nervous about being able to restore everything properly from distribution disks and other sources. First, make a master backup of your entire disk. You can do this with FSave using any of the methods described above, or you can just use "pkzip" or your favorite archiving program in the usual manner. (You should get a _l_a_r_g_e stack of floppy disks ready, however.) Then, create a configuration file in the root directory of the disk and specify "DateAll" to be the day after you created the master backup. That's all there is to it. You don't even need to create any other configuration files unless certain directories need not be saved, or con- tain files that need not be saved. When your backups become large enough to be a nuisance, make a new master backup of the whole disk and then modify the "DateAll" appropriately. 1.5 - 27 - 7/29/94 FSave 9. Restoring Files from Backups Restoring files after a hard disk failure is straightforward, if tedi- ous: reload the operating system, reload all software packages from their installation media or your master backups, then reload the latest backup. It is impossible to give specific instructions on how to "reload the latest backup", as the exact procedure depends on what archiving program you used to create the backup. However, here are some general hints. (1) FSave stores the pathname for each saved file relative to the direc- tory you were in when you made the backup. In order to restore your files to their proper locations, change to that same directory before beginning to restore files. (2) Use whatever program is appropriate to extract files, for example, if you used "pkzip" to create the archive, then use pkunzip to extract files from it. Run this program on each archive file, one by one, until you have restored them all. (3) If the extraction program has an option that preserves the directory structure of the restored files, use it. If this is not done, all your files will end up in the root directory. (4) It is irritating to restore files from a backup that takes more than one diskette when you are using a program such as pkunzip which requires you to begin by inserting the last disk of an archive. This is because you need to know whether each archive file is split across two or more diskettes, and if so, which diskettes it resides on. This is most easily handled by printing the directory listing of each diskette before beginning to restore your files; when you are asked to insert the last diskette for an archive, simply consult the directory listings beginning with the one for the current diskette to find the one that contains the last part of the archive. For archive files which are contained entirely on the current diskette, there is no need to insert any other one. If you are lucky enough to have the space to be able to create your backup files right on the hard disk, restoring files is much easier. This is because the entire archive file is on the disk, so there is no need to be swapping diskettes in and out. 9.1. Re-Deleting Deleted Files This is tedious, but not difficult. But there is a complication. Suppose you bought a brand new application, loaded it on your system, and then decided to delete the several files containing tutorials and examples. After backing up this directory several times, the disk fails. Now you've gotten your disk repaired and want to reload it, so you follow the steps listed above. When you are finished, you will find that the tutorials and examples have reappeared. This problem is solved with the directory index. 1.5 - 28 - 7/29/94 FSave 9.2. Directory Index A "directory index" ($$$) is just a list of all the files in a direc- tory, whether they are saved or not; it is written to the file "fsave.idx", and saved in the backup. After restoring a directory from backup diskettes, it may contain files had been deleted. The "reconcil" program ($$$) provided with FSave can then be run to reconcile the directory con- tents with the index. This program deletes files that should not be there, and reports differences between the actual directory contents and the con- tents as specified in the index file. When this is completed, the index file itself is deleted. Directory index files are not created by default because of the addi- tional time and space that they require. The "DirectoryIndex" ($$$) entry in the initialization file is used to enable directory indices. 9.3. Restoring Individual Files Restoring a specific file from a backup is takes two easy steps. (1) Determine which archive the file is in. This can be done by using an editor to examine the list files which are written to the first diskette. Or, you can use your archive extracting program to print a list of what is in each archive file. (2) When you know which archive the desired file is in, use your archive extracting program to extract it. If you wish to put the file to where it originally resided, change to the directory you were in when you created the backup before restoring, and if your extracting program has an option to preserve the directory struc- ture of the restored file, use it. If you want the file to be restored somewhere else, either do the restore from a different directory, do not use the option to preserve the directory structure, or both. 10. Incremental Backups When even FSave backups begin to get cumbersome, consider doing incre- mental backups interspersed with an occasional full backup. In an incre- mental backup, files are selected for backup in the usual manner, and then one additional constraint is imposed: the archive bit must be set. For this to work, the archiving command used for full backups must clear the archive bits of the files saved. Then, as files are modified, their archive bits are set; the next incremental backup will save only those files that have been modified since the last full backup. 10.1. Incremental and Delta Backups An incremental backup saves everything modified since the last full backup was taken. To do this, the archiving command used for incremental backups must not clear the archive bits of files saved. Thus, each incre- mental backup contains all of the files on the preceding one, and possibly 1.5 - 29 - 7/29/94 FSave some new ones. Incremental backups get larger and larger, then, as time goes by. When they get uncomfortably large, a full backup is done. The next incre- mental backup will be small again. An alternative strategy is what I call "delta" backups. This is the same as an incremental backup except for one thing: the archive bits of files saved in a delta backup are cleared after the backup is completed. This means that each delta backup saves only those files that were changed since the last delta backup, so they do not continue to grow larger and larger. On the other hand, no single delta backup contains all of the files that have changed since the last full backup. This makes restoring from delta backups more tedious, as described below. FSave allows you to choose either incremental or delta backups. This is specified indirectly in the command you provide to do incremental back- ups: if the command causes the archive bits to be cleared, you get delta backups. If the command does not clear the archive bits, you get incremen- tal backups. Be aware, however: this is just another tradeoff. The price paid for the benefit of the smaller and faster incremental backups is that restoring your disk will take more time. 10.2. Restoring from Incremental Backups To restore from incremental backups, you begin by doing all the same steps described earlier, but then the latest incremental backup (or all of the delta backups, in order) must also be reloaded. Even restoring a sin- gle file is more complex: to get the latest version of a file, the latest incremental backup must be checked to see if it contains the file; if not, the latest full backup is used. Delta backups are even worse: all of the delta backups done after the most recent full backup must be examined in reverse order; the first one that contains the desired file is used. If this sounds bad, remember that we hope to be restoring files much less often than we back them up. If restores are needed frequently, your configuration files should probably specify backing up more files, and you should avoid incremental or delta backups to simplify restorations. 11. Alternate Configurations FSave allows several different sets of configurations to exist on the same disk. This is done by storing the configurations with different names and using command line options to select from among them. 11.1. Specifying an Alternate Configuration The default configuration is always stored in files named "fsave.cnf" in various directories on the disk. With the "/n" option, a different name can be specified. For example, the command: 1.5 - 30 - 7/29/94 FSave fsave /n fsaveall ($$$) would do the usual filesave activity, but would look for configuration information in files named "fsaveall.cnf". The "/N" ($$$) option works in much the same way, except that if a directory does not contain a configuration with the specified name, then FSave tries to read the default configuration file instead. 11.2. Using Alternate Configurations Multiple configurations may be used in many ways. First, they provide a simple way to create master backups of specified directories: while the ordinary configuration specifies a date and directories to skip, an alter- nate configuration might specify none of these, thus saving the entire disk or directory. Second, they can be used to set up a multilevel incremental backup scheme, in which different configurations specify different dates and/or file/directory combinations. One final example uses different configurations to back up different subsets of the disk. For example, you might wish to save the contents of one set of directories on 1.44 Mb floppy disks, but save a different set of directories on 1.2 Mb floppies. Or perhaps each different user of a system might wish to use their own configurations to back up their own subset of the data on the system. 12. Unix-Style Filename Patterns 12.1. Overview Filename patterns on Unix systems are for the most part a superset of MS-DOS filename patterns. Unix-style patterns may contain ordinary charac- ters and wildcard characters. Ordinary characters appearing in a pattern must match the next charac- ter in the filename. On Unix systems, case is significant; MS-DOS filenames are all monocase, so FSave translates all filenames and filename patterns to upper case when they are read. Note that the period is con- sidered to be an ordinary character. The first wildcard character is the asterisk, which matches zero or more of any characters, including the period. The second wildcard character is the question mark, which matches exactly one character. This is different from the MS-DOS interpretation which, in some circumstances, allows the question mark to match either zero or one character. Finally, the square brackets enclose a character class: this matches any one of the characters contained in the class. Character classes may contain character ranges such as "a-z" and "0-9;" this is equivalent to 1.5 - 31 - 7/29/94 FSave specifying each of the individual characters in the range. A character class that begins with a caret (^) is interpreted as containing only those characters that are not contained in the brackets. 12.2. Examples Several examples given below. * Matches zero or more characters. Because the dot is treated as an ordinary character in a filename, this pattern matches all names. *.txt Matches all filenames with the extension "txt". *.* Matches zero or more chars, then a dot, then zero or more additional chars. This matches all filenames that have an extension (with no extension, there is no dot). a* Matches all files that begin with an "a". a*b Matches all files that begin with an "a" and end with a "b", such as "ab", "a.b", and "abcde.dcb". ??? Each question mark matches exactly one character, so this pattern matches all filenames containing exactly three characters. This would include "abc" and "a.b", but not "a.txt" (remember that the dot counts as a character). a?b Matches all names that begin with an "a", end with a "b", and have exactly one character between. This would include "a.b" and "acb", but not "ab", "a.bb", or "a.ba" . [abc] Matches only the filenames "a", "b", and "c". [abc]* Matches all filenames that begin with "a", "b", or "c". [^abc]* Matches all filenames that begin with any character other than "a", "b", or "c". *[ab][cd]* Matches all filenames that contain "ac", "ad", "bc", or "bd" anywhere in their name. 1.5 - 32 - 7/29/94