Copying Data to a Stack of Directories/ZIP Archives

nnbackup.exe ver -n 3 -i c:\data -o d:\backup\data\ [options]
nnbackup.exe verz -n 3 -i c:\data -o d:\backup\data\ [options]

This is the most reliable method of backing up your data. It allows to create an unlimited number of exact copies of the source data which are saved to numbered directories (a stack of directories) or numbered zip archives (a stack of zip archives). To copy your files to a stack of directories use command ver, and to copy to a stack of zip archives use verz.

You can yourself choose the depth of a stack (e.g. N): this is the number of copies you are going to keep. Stack depth is specified in command line with key -n . All backup copies are saved to numbered directories/zip archives (with numbers from 1 to N), the latest (newest) copy is saved as #1, the second newest one as #2 etc. When the number of copies exceed the specified depth (N), the oldest copy is automatically removed. Each of the numbered directories/zip archives includes all files from the data source in accordance with the inclusive and/or exclusive masks specified by the user.

Please note that the compression library (zlib) which is used in nnBackup impose a limitation on the size of zip archives that can be created - they cannot be larger than 2 gigabytes. If you want to handle large amounts of data, it is a good idea to copy your data to a directories stack (ver) instead of zip archives stack (verz), or call the external command line archiever by specifying the -extzip nnBackup option. See the description of -extzip option for more details.

Here is an example to illustrate the above information: let us suppose that we want to create a backup of important data (directory c:\data) every day. We would like to keep 7 copies of c:\data (as many as there are days in a week) in directory d:\backup: in this way, we can restore the data in a condition that they were in on any of the last seven days. The depth of our directory stack here would be 7. Here is what we type in command line to achieve this result:

nnbackup.exe ver -n 7 -i c:\data -o d:\backup -s -x *.tmp -v

Explanation: create backup copies of c:\data in a directory stack whose depth is 7. The output directory is: d:\backup. Copy data from subdirectories. Don't copy files with .tmp extension. Display on console the names of files that are being copied

We will start nnBackup with this command each day during a week: on Sunday, on Monday etc. When nnBackup is run for the first time, it will create directory d:\backup\1 containing a copy of data from c:\data. When it is run the next time, it will create directory d:\backup\2 etc. After the number of backup directories reaches the specified stack depth, nnBackup will start to remove the oldest backup directory (in our case it would be #7) during each backup session. Therefore, the number of existing copies always will be equal to the specified number of stacks. The #1 directory will always contain the latest copy, and the #7 directory will always contain the oldest one (7 days old). If in the above example we used command verz instead of ver, then nnBackup would create numbered zip archives instead of numbered directories: d:\backup\1.zip, d:\backup\2.zip ... d:\backup\7.zip.

The command line option -n is not required for nnBackup to work in this mode. If -n option is omitted or set to 0, nnBackup would not create a directory stack, but would copy the data directly to the output (target) directory, clearing this directory before copying the files: please keep this in mind lest you lose some valuable information.

nnbackup.exe ver -i c:\data -o d:\backup
nnbackup.exe ver -n 0 -i c:\data -o d:\backup

Let us go over it once more: the output directory is cleared only when the backup data are copied to a stack of directories if option -n is omitted or set to 0. IF files are copied to a stack of zip archive, the output directory is not cleared.

When working in the mode of copying to a stack of directories/zip archives, you can specify 2 or more of input (source) directories/files:

nnbackup.exe ver -n 7 -i c:\data -i c:\another_data -o d:\backup\data
nnbackup.exe verz -n 7 -i c:\data -i c:\another_data -o d:\backup\data

Keep in mind that in ver/verz modes (as well as all the other modes) you can fine-tune the program's behavior by specifying what types of files should be processed. For example, you can use inclusive or exclusive filename masks (-m, -x), filters of the creation and/or last modification date (-D, -DC, -DW), file size filters (-LT, -GT) and file attributes filters (options -a, -ax).

The following command line options were expressly created for use in the mode of copying data to a directory stack: more.

The -nocopy option will allow you to test the command you are going to use: nnBackup will imitate the process of copying data to a stack of directories/zip archives, but the files won't be actually copied:

nnbackup.exe ver -n 7 -i c:\data -o d:\backup\data -v -nocopy

Examples:

nnbackup.exe ver -i c:\data -o d:\backup\data -s -e -v

Explanation: Clear directory d:\backup\data of all of its contents and copy to it all files from c:\data. When copying the files, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths. Copy empty directories.

nnbackup.exe ver -i c:\data -o d:\backup\data -n 7 -m *.zip,*.rar,*.arj -s -v

Explanation: Copy all data from c:\data to a directory stack 7 levels deep (i.e. 7 copies of data will be kept). Numbered copies will be saved to d:\backup\data. Copy only files with extensions .zip, .rar and .arj. When copying the files, nnBackup will take in account all subdirectories in c:\data and display/write to log the full file paths.

nnbackup.exe ver -i c:\data -i c:\second_data -i c:\third_data -o d:\backup\data -n 7 -s -e -v 

Explanation: Copy data from 3 directories (c:\data, c:\second_data and c:\third_data) to a directory stack 7 levels deep, i.e. we shall keep 7 copies of our data. Numbered copies will be saved to d:\backup\data. Copy only files with extensions .zip, .rar and .arj. When copying the files, nnBackup will take in account all subdirectories in the input directories. Copy empty directories.

nnbackup.exe verz -i c:\data -i c:\second_data -i c:\third_data -o d:\backup\data -n 7 -s -e -v 

Explanation: Same as above, but data is copied to a zip archive stack instead of directory stack, i.e. d:\backup\data will contain seven numbered zip archives instead of directories.

nnbackup.exe verz -i c:\data -i c:\second_data -i c:\third_data -o d:\backup\data -n 7 -sdn "documents" -s -e -v 

Explanation: Same as above, only now we specify a name for zip archives containing the backup of your data: 1_documents.zip, 2_documents.zip ... 7_documents.zip.


See also: