Created
July 19, 2023 17:34
-
-
Save ChristopherHaws/5eb5e6508e74e4633140822a7ef0b4a1 to your computer and use it in GitHub Desktop.
scan file for virus and move it if it is clean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC_DIR="/source/directory/path" | |
DEST_DIR="/destination/directory/path" | |
LOG_FILE="/path/to/clamscan.log" | |
find "$SRC_DIR" -type f | xargs -I {} -P $(nproc) sh -c " | |
if clamscan -i --no-summary '{}' | |
then | |
rsync -avz --progress '{}' '$DEST_DIR' | |
else | |
echo '{} is infected and not copied' | tee -a '$LOG_FILE' | |
fi | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment