Wednesday, September 2, 2015

Script: Find files without group read permission and give read permission to group

#!/bin/bash
# find files without group read permission and assign group read permission
#
S_PATH=/tools/archive/data_archive/MHRD

# condition check the search path
if [ ! -d ${S_PATH} ]; then
echo "Error " Please check the search path. ${S_PATH} dir does not exist"
exit 1
fi

# search command
/usr/bin/find ${S_PATH} -type f ! -perm -040 -exec /usr/bin/chmod g+r {} \;
# EOF

No comments:

Post a Comment