Deleting Absent Data from a Backup Copy

nnbackup.exe delabsent -i c:\data -o d:\backup\data [options]
nnbackup.exe delabsent -i c:\data -i c:\another_data -o d:\backup\data -p [options]
nnbackup.exe delabsent -il filelist.txt -o d:\backup\data [options]

nnBackup has a mode in which is just deletes from the target (output) directory all the files absent in the source directory, without copying any other files (we'll call this mode delabsent mode for short).

This mode is convenient when you just want to get rid of unnecessary files instead of performing a full synchronisation of two directories (sync/sync2). The delabsent mode is also convenient to use when one has a slow network connection and synchronising several directories (sync) takes much longer time than a simple copying of new and changed files (copy with options -D, -DC, -DW) followed by clearing of the target directory from the data that are absent in the source directory.

Use option -s to include all the subdirectories.

Keep in mind that in the delabsent mode (as well as all the other modes) you can fine-tune the program's behavior by specifying what types of files should be processed (removed in this case). 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):

nnbackup.exe delabsent -i c:\data -o d:\backup\data  -m *.htm,*.html -s -v

When removing unnecessary data, you can specify several input directories in the command line (option -i), but in this case be sure to use option -p: nnBackup will check the directory tree in the target directory with the full path of a file in the source (input) directory. In this way, nnBackup can see from what directory a file was copied:

nnbackup.exe delabsent -i c:\data -i c:\another_data -o d:\backup\data  -p -s -v

Option -il and -il-, which can be used instead of -i in delabsent mode, provide additional possibilities:

-il<[@]filename>

- Location of a list of files against which files in the target directory will be checked. All files that are not in the list will be deleted from the target directory. nnBackup does not check if the listed files actually exist. This option is used instead of -i.

-il- <[@]filename> - Location of a list of a files to be removed from the target directory. All files that are in the list will be deleted from the target directory. nnBackup does not check if the listed files actually exist. This option is used instead of -i.

Use option -il if you have made a full list of files in a specified directory and now want to use it to remove from the target directory all the files that are not in the list. Option -il- works in a "reverse" way: instead of removing all the files that are not in the list, nnBackup will remove from the target directory all the files that are in the list.

The best thing about this options is that nnBackup doesn't check if the files in the list actually exist. That means that after creating a file list (see Working with File Lists) you will be able to "tidy up" the target directory even if you don't have the source (input) directory (e.g. when working on a different computer): all you need is a copy of a file list and nnBackup.

The -nocopy option will allow you to test the command line that you are going to use: nnBackup will imitate the process of deleting, but the files won't be actually deleted:

nnbackup.exe delabsent -i c:\data -o d:\backup\data  -m *.htm,*.html -v -nocopy

Examples:

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

Explanation: Removing from d:\backup\data all the files that are not present in c:\data. nnBackup will take in account all subdirectories and display/write to log full file paths.

nnbackup.exe delabsent -i c:\data -o d:\backup\data  -m *.htm,*.html -s -v

Explanation: Removing from d:\backup\data all htm and html files that are not present c:\data. nnBackup will take in account all subdirectories and display/write to log full file paths.

nnbackup.exe delabsent -il- c:\filelist.txt -o d:\backup\data -v

Explanation: Removing from d:\backup\data all the files present in filelist.txt. nnBackup doesn't check if the files in the file list do actually exist on the disk. While removing files, nnBackup will display/write to log the full file paths.


See also: