Files, directories and filesystems can be excluded and included in Sophos Anti-Virus for UNIX/Linux scans using the command line options -exclude and -include. NOTE: These options apply to to on-demand scans executed with sweep (SAV4) or savscan (SAV7/9).
For more on exclusions, see the knowledgebase article on the --expand-wildcards option.
What to do
-exclude
You can use -exclude to specify which items you would like Sophos Anti-Virus to avoid scanning. Any items (files, directories or filesystems) following the command line option -exclude will be excluded from scanning.
For example
sweep fred/home harry/home -exclude tom/home peter/home
will scan fred/home and harry/home, but not tom/home or peter/home.
-include
Any items following the command line option -include will be included in the scan, even if they would otherwise have been excluded.
Using -exclude and -include together
Both -exclude and -include can be used in the same set of commands.
For example
sweep fred/home harry/home -exclude tom/home peter/home -include bill/home
scans items fred/home, harry/home and bill/home and all their contents. It does not scan tom/home or peter/home.
Subdirectories
The option -exclude can be used to exclude files or directories under another directory. For example
sweep /home/fred -exclude /home/fred/games
will scan all of Fred's home directory except for the directory games and all directories and files under it.
The option -include can be used to select files that otherwise would not have been scanned. For example
sweep /home/fred -exclude /home/fred/games -include /home/fred/games/chess
will scan all of the directory /home/fred except /home/fred/games, but will also scan /home/fred/games/chess. The order of the command line qualifiers is not important, the command
sweep /home/fred -include /home/fred/games/chess -exclude /home/fred/games
scans exactly the same files as the first example.
Specifying an exclusion list as a file
Items to be scanned can be specified in an "arguments file" as well as command line. Use the command line option --args-file=.
This file can also include a list of items to exclude, using the option -exclude.