You can discard unsolicited resumes or keep them, but your practice should be consistent. Keeping some while discarding others could open you up to discrimination claims if your hiring decisions were ever challenged.
If you don’t want to receive or keep unsolicited resumes (which is safest from a liability standpoint), you should post on your job advertisements that unsolicited resumes will not be accepted. When you do receive them, don’t review them—simply delete the file or email or shred the document. If you opt to keep unsolicited resumes, you should maintain them for the time you would keep solicited resumes—one year (or two, if you’re a federal contractor).