From 82911bbc53d9012fc654c94bc7487827c2054b0d Mon Sep 17 00:00:00 2001 From: Wireghoul Date: Fri, 9 Apr 2021 12:12:45 +1000 Subject: [PATCH] added onlyfiles additional script --- misc/onlyfiles.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 misc/onlyfiles.sh diff --git a/misc/onlyfiles.sh b/misc/onlyfiles.sh new file mode 100755 index 0000000..c7b0698 --- /dev/null +++ b/misc/onlyfiles.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Scan only specific file types +# usage: ./onlyfiles.sh +# example: ./onlyfiles.sh js *.js,*.ts,*.php /some/dir +OIFS=$IFS +IFS=',' +filter="-type f ( " +for inc in $2; do + if [ -z $incfiles ]; then + incfiles="-name $inc" + else + incfiles="$incfiles -o -name $inc" + fi +done +filter="$filter $incfiles )" +IFS=$OIFS +find "$3" $filter -exec graudit -d "$1" -B {} \;