Skip to content

Instantly share code, notes, and snippets.

@yuxel
Created October 25, 2011 11:43
Show Gist options
  • Save yuxel/1312424 to your computer and use it in GitHub Desktop.
Save yuxel/1312424 to your computer and use it in GitHub Desktop.
yilmaz.sh
#!/bin/bash
#bunu
matching="yuxel www-data"
#buna cevir, bundaki ':' ya dikkat
convertTo="yuxel:yuxel"
#her dosyada (bunu dizin için de yapmak istersen -type d ile bi daha dönmen gerekeek galiba
for i in `find * -type f`; do
#owner ve group'u al
owngrp=`ls -al $i | awk '{print $3 , $4;}'`;
#eger uyuyorsa degistir
if [ "$owngrp" = "$matching" ]
then
sudo chown $convertTo $i
echo "changing $i"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment