$ cat init.sh
#!/bin/sh
set -x
SRC=/opt/from
DST=/opt/to
for d in $SRC/*/; do
BASE=`basename "$d" `
if [ ! -d "$DST/$BASE" ]; then
cp -r $d "$DST/$BASE"
fi
done
for dir in $SRC/*/; do
FNAME=$(basename $dir)
find $DST/$FNAME -type d -exec chown 2023:2023 {}\;
find $DST/$FNAME -type d -exec chmod 700 {} \;
find $DST/$FNAME -type f -exec chown 2023:2023 {}\;
find $DST/$FNAME -type f -exec chmod 400 {} \;
done
网友评论