Working with Filelists

nnBackup provides convenient tools for working with filelists: it can take filelists as an argument for further processing (copying files, performing synchronisation etc.) and it can generate such filelists.

First of all, let's discuss how filelists are created. Filelist is a list of files selected according to a certain principle. Options -list, -list2 and -list3 are used to save to a specified text file names and relative paths of files that were backed up during the last backup session. Option -list is used to save to a list names and relative paths of all the files that were copied, option -list2 only saves names and relative paths of those files that were copied from input directory to output directory during a bidirectional synchronisation, and option -list3 is used to save to a list all deleted files and directories. Files' paths are relative to the current working directory.

In order to save full (absolute) paths, use option -fp.

You can very precisely specify what files to include in a filelist; for that purpose, you can use all the means provided by nnBackup: inclusive and exclusive masks, date and time of last modification of a file, including of subdirectories etc.

Examples:

nnbackup.exe copy -i c:\data -o d:\backup -s -v -list filelist.txt

Explanation: Copy all files from from directory c:\data and all its subdirectories to d:\backup and save a list of files to filelist.txt

nnbackup.exe copy -i c:\data -o d:\backup -m *.doc,*.rtf -s -v -list filelist.txt

Explanation: Copy all *.doc and*.rtf files from directory c:\data and all its subdirectories to d:\backup and save a list of files to filelist.txt

nnbackup.exe copy -i c:\data -o d:\backup -m *.doc,*.rtf -D 01.01.2003 -s -v -list filelist.txt

Explanation: Copy all *.doc and*.rtf files that has been modified or created since 01.01.2003 from directory c:\data and all its subdirectories to d:\backup and save a list of files to filelist.txt

You may ask: Is it necessary to actually copy files from one directory to another each time we want to create a filelist? No, it is not. If you want to generate a filelist without actually copying the files, you can use option -nocopy which "tells" nnBackup to simulate the entire process (according to the specified options) without actually copying files.

Let's re-write all the above examples in such a way that filelists are created, but files are not copied:

nnbackup.exe copy -i c:\data -o d:\backup -s -v -list filelist.txt -nocopy

Explanation: Create a filelist (filelist.txt), containing all the files from directory c:\data and all its subdirectories.

nnbackup.exe copy -i c:\data -o d:\backup -m *.doc,*.rtf -s -v -list filelist.txt -nocopy

Explanation: Create a filelist (filelist.txt), containing all the *.doc and *.rtf files from directory c:\data and all its subdirectories.

nnbackup.exe copy -i c:\data -o d:\backup -m *.doc,*.rtf -D 01.01.2003 -s -v -list filelist.txt -nocopy

Explanation: Create a filelist (filelist.txt), containing all the *.doc and *.rtf files modified or created since 01.01.2003 from directory c:\data and all its subdirectories.

Besides generating filelists, nnBackup can also take them as an argument for further processing (copying files, synchronisation etc.). If you have a filelist (generated by nnBackup or by another program), you can pass it as an argument to -i option in form of @filename. Let's imagine that we have a filelist files.txt:

c:\data\1.txt
c:\data\2.txt
c:\data\3.txt
c:\data\4.txt
c:\data\5.txt
c:\data\6.txt

Now we'll submit it it to nnBackup for processing:

nnbackup.exe sync -i @files.txt -o d:\backup\data -v
nnbackup.exe copy -i @files.txt -o d:\backup\data -v

So, option -i can take as its argument not only name of directories, but also filelists.

The mode of Deleting of absent data from a backup copy has special options for working with filelists: -il and -il-. Use option -il if you have a full list of all files in a certain directory and want to use it to remove from the output directory all the files that are not on the list. Option -il- does exactly the contrary: instead of deleting the files not on the list, it will remove from the output directory all the files that are on the list.

What is great about these options is that nnBackup does not check if the files listed on a filelist are physically present on a computer. That means that if you create a filelist, you can then easily cleanup an output directory even if no copy of input directory is available (for example, it the output directory is located on another computer): all that you need to have is the filelist itself and nnBackup.

Here is how you can do it: First of all, let us generate a full list of files in the input directory (filelist.txt):

nnbackup.exe copy -i c:\data -o c:\temp -v -s -list filelist.txt -nocopy

If you want to use option -il-, you can create a list of "unnecessary" files that should be deleted (filelist_del.txt):

nnbackup.exe delabsent -i c:\data -o d:\backup\data -v -s -list3 filelist_del.txt -nocopy

Now, with these list in hand, we can delete obsolete files on all the computers that we can access. Presence of the input directory on this computers is not necessary, because nnBackup is not going to check for physical presence of files anyway:

nnbackup.exe delabsent -il filelist.txt -o f:\another_backup\data -s -v
nnbackup.exe delabsent -il- filelist_del.txt -o f:\another_backup\data -s -v