External media such as USB drives are checked for viruses before they are connected to a computer
Before they are read, external storage peripherals (hard disks, USB sticks, optical disks, memory cards etc.) are scanned by antivirus software.
The obligatory scanning of storage peripherals allows the detection of infected media before the host computer can be manipulated. This is a compromise that avoids eliminating USB ports altogether.