摘要 |
A file scanning method and apparatus. The method comprises: acquiring the number of hard links of a to-be-scanned file serving as a scanning object (100); if the number of the hard links of the to-be-scanned file is greater than 1, when the to-be-scanned file serves as the scanning object for the first time, invoking a scanning engine to scan the to-be-scanned file so as to acquire a scanning result, and storing a file identification identifier used for uniquely identifying the to-be-scanned file and the scanning result into a storage unit (102); and when the to-be-scanned file serves as the scanning object again, querying and acquiring the scanning result of the to-be-scanned file from the storage unit according to the file identification identifier (104). A file with the number of hard links greater than 1 is scanned only when the file serves as a to-be-scanned file for the first time, and the result of the first scanning is directly acquired when the file serves as the to-be-scanned file again, so as to avoid repeated scanning, which effectively reduces IO overheads and CPU overheads in the scanning process and improves the file scanning efficiency. |