6. Basic exclude examples

The basic syntax for coding exclusions from backup may be gleaned from the existing examples in the TSM option files. The following is a summary to illustrate some of the possibilities offered.

Each line in each of the following examples is made up of two elements. The lines can be entered at the end of the TSM configuration file as described above in e.g. excluding files from backup by editing the TSM configuration file. They may also be used in the graphical user interface as described in excluding files from backup using the graphical user interface by selecting the first element (usually Exclude.Dir, Exclude or Include) as the entry for Type, and then entering the second element under File or Pattern.

  • The default is to include a file for backup. If a file does not match either an Exclude or Include directive in the configuration file then it will be included for backup.
  • The include/exclude list is processed bottom up. If you add the following two lines to the bottom of the configuration file
                              Include  C:\XYZ.DOC
                              Exclude  C:\XYZ.DOC
    then the file XYZ.DOC will not be backed up. The processor will read the list from bottom up, and acts on the first, and only the first, directive that applies. In this case, the Exclude directive is read first, applied and the processor then grabs the next file and so on.
  • To specify a directory path or filename with spaces in it, enclose it fully in quotation marks, as below:
                               Exclude "C:\My Documents\tempfiles\*"
                               Exclude "C:\Program Files\xyz\*"
  • To exclude the contents of a directory and all its subdirectories, use the Exclude.dir directive:
                              Exclude.dir C:\testdata
    Note, however, that a perhaps unexpected outcome of this rule is that the names of the directory that is excluded will be sent to the HFS and will so be displayed in the restore window when you perform a restore. However, the file contents of such directories will not be displayed, as they will have been excluded.
  • Exclude.dir directives are processed before all other directives. If you added the following two lines to the bottom of the configuration file
                              Exclude.dir  C:\testdata
                              Include      C:\testdata\test1\summary.dat
    then the file "summary.dat" will not be backed up even though the Include directive is below the Exclude.dir directive. The Exclude.dir directives are read and processed first.
  • To check the order in which exclude directives are processed open the TSM command line client and at the tsm> prompt enter query inclexcl as below:
                              tsm> query inclexcl
    The output will list the directives in the order in which they will be applied. As described above, you may also check what data may be backed up by running the GUI and browsing the files on your machine: TSM will not permit excluded files to be backed up, and will mark them with a barred red circle to indicate this.
  • To exclude multiple files with a common component in their name, use * and ? wildcards. The * matches any number of any character; the ? matches any single character. Thus to exclude any files whose names begin temp in the C:\tempdata folder use:
                              Exclude  C:\tempdata\temp*
    To exclude any files whose names begin with a variable single character then followed by _temp.dat in the C:\tempdata directory, use:
                              Exclude  C:\tempdata\?_temp.dat
  • To exclude numerous directories use the ... wildcard. Thus to exclude a directory called cache and all its contents and sub-directories anywhere on drive C:, use:
                              Exclude.dir  C:\...\cache
    If, however, you have 100 directories called temp00, temp01, temp02 and so on up to temp99 on the C: drive, then you can do either of the following:
                              Exclude.dir C:\temp*        
                              Exclude.dir C:\temp??
  • To exclude the contents of a directory but include the contents of all its sub-directories:
                              Include  C:\data\...\*
                              Exclude  C:\data\*
    This will exclude any file in the C:\data directory but will include for backup any file in any subdirectory under C:\data. Note the order is important: The Exclude directive must follow the Include directive in the configuration file.
  • To do the reverse and include the contents of a directory but exclude the contents of all its sub-directories:
                              Include       C:\data\*
                              Exclude.dir   C:\data\...\*
    This will exclude any file in any sub-directory of C:\data but will include for backup any file in the C:\data directory.

If you use the automatic scheduled backups, you must now restart the TSM scheduler after making changes to the exclude rules. If you do not do this then the change(s) that you have made will not be honoured on the scheduled backups. Please see our instructions for restarting the scheduler for Windows, Mac, Linux and Solaris. Alternatively, restarting your machine will have the same effect as restarting the TSM scheduler.

Up: Contents Previous: 5. Excluding everything from backup except specific files or folders