This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to scan only certain folders

Apologies for what may be a dumb question, but I've searched through he FAQs and this forum and can't find the answer.

My question: it's obvious how to exclude certain folders from on-access scanning, but how do I flip that on its head and INCLUDE only certain folders and NOT scan the rest?

Specifically, I would like to run on-access scanning ONLY on my Apple Mail directory (~/Library/Mail), Desktop (~/Desktop), and downloads folder (~/Downloads).  I want to NOT scan everything else.

How do I do that?  Thanks in advance.

:1001163


This thread was automatically locked due to age.
Parents
  • Something else to add...

    You might think you want only to scan those areas, but what happens when a new piece of malware is discovered and detected after you've already downloaded it, scanned it, and moved it to somewhere else on your machine?

    If you really don't want to do things this way, I suggest you set up Folder Actions in those locations and script them to "scan now" every time the folder is updated (by adding/removing a file).  You will, however, be severely degrading your protection.

    The simplest method of doing something like this is to right click (control click)  on a folder, select "Folder Actions Setup..." from the bottom, select "add - new folder item.scpt" click attach, and then check the "Enable Folder Actions" checkbox.

    This will give you a basic alert when the contents of the folder changes.

    To make it auto-scan instead, you will need to replace the script with

    property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
    
    on adding folder items to this_folder after receiving added_items
    	try
    		tell application "Sophos Anti-Virus"
    			scan finder items added_items
    		end tell
    	end try
    end adding folder items to

    You can do this easily by copying the above code, clicking the Edit Script button, select all text, paste, save as, and name the new script something like add - scan new items.scpt

    Then click the - button on the bottom right of the Folder Actions window to remove the old script, and click the + to add a new one.  Select your new script, and you're done!  From now on, any folder that you set this folder action for will have any new items automatically scanned when they're added.

    This method is the same as an on-demand scan, so on-access can (cringe) be disabled if you do this.  As I said, this is not recommended, but it's doable.

    Also, you probably want to add your Shared folder to this list as well, as anyone can write to that folder if you're on a network.

    :1001201
Reply
  • Something else to add...

    You might think you want only to scan those areas, but what happens when a new piece of malware is discovered and detected after you've already downloaded it, scanned it, and moved it to somewhere else on your machine?

    If you really don't want to do things this way, I suggest you set up Folder Actions in those locations and script them to "scan now" every time the folder is updated (by adding/removing a file).  You will, however, be severely degrading your protection.

    The simplest method of doing something like this is to right click (control click)  on a folder, select "Folder Actions Setup..." from the bottom, select "add - new folder item.scpt" click attach, and then check the "Enable Folder Actions" checkbox.

    This will give you a basic alert when the contents of the folder changes.

    To make it auto-scan instead, you will need to replace the script with

    property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
    
    on adding folder items to this_folder after receiving added_items
    	try
    		tell application "Sophos Anti-Virus"
    			scan finder items added_items
    		end tell
    	end try
    end adding folder items to

    You can do this easily by copying the above code, clicking the Edit Script button, select all text, paste, save as, and name the new script something like add - scan new items.scpt

    Then click the - button on the bottom right of the Folder Actions window to remove the old script, and click the + to add a new one.  Select your new script, and you're done!  From now on, any folder that you set this folder action for will have any new items automatically scanned when they're added.

    This method is the same as an on-demand scan, so on-access can (cringe) be disabled if you do this.  As I said, this is not recommended, but it's doable.

    Also, you probably want to add your Shared folder to this list as well, as anyone can write to that folder if you're on a network.

    :1001201
Children
No Data