Friday, June 3, 2011

bash script for copying and chown-ing contents of /home


BASE="/home/ec2-user/feeds/transit"

for file in /home/*
do
if [ "$file" != "/home/ec2-user" ]; then
echo Copying ${file} to ${BASE}${file}
mkdir -p ${BASE}${file}
sudo bash -c "cp -vr ${file}/* ${BASE}${file}"
fi
done
sudo bash -c "chown -vR ec2-user:ec2-user $BASE/*"

0 comments:

Stats