Examples using wildcards with include and exclude patterns

The backup-archive client accepts the exclude.dir option, which can be used to exclude directory entries. However, the include and exclude.dir options cannot be used together.

Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsNote: In the dsm.sys file, the include and exclude options do not work with symbolic links to directories. For example, do not use /u in your include or exclude statements because /u is a symbolic link to the /home directory. Instead of entering:
   include /u/tmp/save.fil
enter:
   include /home/tmp/save.fil

Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsHowever, the exclude option does work with symbolic links to directories when you enter a backup command with the absolute path that contains the symbolic link.

Table 1 shows how to use wildcard characters to include or exclude files.

Table 1. Using wildcard characters with include and exclude patterns
Task Pattern
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all files that end with .doc, except those found in the home directory of aleko, Documents directory. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE /.../*.doc
INCLUDE "/home/aleko/Documents/
  *.doc"
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all files during backup with an extension of bak, except those found on the /usr file system in the dev directory. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude /.../*.bak
include /usr/dev/*.bak      
Windows operating systemsExclude all files during backup with an extension of bak, except those found on the d: drive in the dev directory. Windows operating systems
exclude ?:\*.bak
include d:\dev\*.bak
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all files and directories under any Documents directory that might exist, except for the Current file of user aleko. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE /.../Documents/.../*
INCLUDE "/home/aleko/Documents/
  Current"
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all files in any directory named "tmp" and its subdirectories, except for the file /home/tmp/save.fil. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude /.../tmp/.../*
include /home/tmp/save.fil
Windows operating systemsExclude all files in any directory named "tmp" and its subdirectories, except for the file d:\tmp\save.fil. Windows operating systems
exclude ?:\...\tmp\...\*
include d:\tmp\save.fil
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude any .cpp file in any directory on the Vol1, Vol2, Vol3, and Vol4 volumes. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE /Volumes/Vol[1-4]/.../*.cpp
Mac OS X operating systemsExclude any .cpp file in any directory on the Vol1, Vol2, Vol3, and Vol4 volumes. Mac OS X operating systems
EXCLUDE /Volumes/Vol[1-4]/.../*.cpp
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude any .cpp file in any directory on the /fs1, /fs2, /fs3 and /fs4 file systems. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE /fs[1-4]/.../*.cpp
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude the .cpp files found in the /fs2/source directory. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE /fs2/source/*.cpp
Windows operating systemsExclude any .obj file for backup in any directory on the c: e: f: and g: drives. Windows operating systems
exclude [ce-g]:\...\*.obj  

The c: e: f: and g: drives are local or removable.

Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude any .o file in any directory on the /usr1, /usr2, and /usr3 file systems. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude /usr[1-3]/.../*.o  
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude the .o files found in the root directory in the usr2 file system only. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude /usr2/*.o
Windows operating systemsExclude the .obj files found in the root directory in the d: drive only. Windows operating systems
exclude d:\*.obj
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude any file that resides under the tmp directory found in any file system. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude /.../tmp/.../*
Windows operating systemsExclude any file that resides under the tmp directory found on any drive. Windows operating systems
exclude ?:\tmp\...\*
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude the entire directory structure /var/spool from all processing. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.dir /var/spool
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude a single file system from backup processing. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.fs /fs1
exclude.fs home:
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all file systems mounted anywhere in the /test/myfs/fs01 and /test/myfs/fs02 directory tree from backup processing. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.fs /test/myfs/fs01/.../*
exclude.fs /test/myfs/fs02/*
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude the /home/mydir/test1 directory and any files and subdirectories under it. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.dir /home/mydir/test1
Windows operating systemsExclude the c:\mydir\test1 directory and any files and subdirectories under it. Windows operating systems
exclude.dir c:\mydir\test1
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all directories under the /home/mydir directory with names beginning with test. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.dir /home/mydir/test*
Windows operating systemsExclude all directories under the \mydir directory with names beginning with test. Windows operating systems
exclude.dir c:\mydir\test*
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all directories directly under the /mydir directory with names beginning with test, on any file system. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.dir /.../mydir/test*
Windows operating systemsExclude all directories directly under the \mydir directory with names beginning with test, on any drive. Windows operating systems
exclude.dir ?:\mydir\test*
Oracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude the raw logical volume from image backup. Oracle Solaris operating systemsLinux operating systemsAIX operating systems
exclude.image /dev/hd0 
Windows operating systemsExclude the raw logical volume from image backup. Windows operating systems
exclude.image c:\*
Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systemsExclude all symbolic links or aliases (aliases apply to Mac OS X) from backup processing, except for the Docs directory for user1. Mac OS X operating systemsOracle Solaris operating systemsLinux operating systemsAIX operating systems
EXCLUDE.ATTRIBUTE.SYMLINK /.../*
INCLUDE.ATTRIBUTE.SYMLINK /Users/
  user1/Docs/*
Windows operating systemsExclude all directories and files on the local drives, except the c: drive. Windows operating systems
exclude     [abd-z]:\...\*
exclude.dir [abd-z]:\...\*