#!/bin/bash
# This script will chmod -x every file within a
# directory recursively, without removing the
# executable nature of the directories contained
# within.
################################################
do_recursion() {
files=`ls`
file=
for i in $files; do
file=$file$i
if [[ ! -e $file ]]; then
file=$file' '
continue
fi
if [[ -d "$(pwd)/$file" ]]; then
echo "descending into directory $(pwd)/$file"
cd "$(pwd)/$file"
do_recursion
fi
if [[ -d "$(pwd)/$file" ]]; then
echo "ascending to directory $(pwd)/$file"
else
echo "chmodding $(pwd)/$file"
chmod -x $file
fi
file=
done
cd ..
return
}
do_recursion
exit 0
# This script will chmod -x every file within a
# directory recursively, without removing the
# executable nature of the directories contained
# within.
################################################
do_recursion() {
files=`ls`
file=
for i in $files; do
file=$file$i
if [[ ! -e $file ]]; then
file=$file' '
continue
fi
if [[ -d "$(pwd)/$file" ]]; then
echo "descending into directory $(pwd)/$file"
cd "$(pwd)/$file"
do_recursion
fi
if [[ -d "$(pwd)/$file" ]]; then
echo "ascending to directory $(pwd)/$file"
else
echo "chmodding $(pwd)/$file"
chmod -x $file
fi
file=
done
cd ..
return
}
do_recursion
exit 0
No comments:
Post a Comment