#!/bin/bash

# script changes permissions for all results files and directories for domains
# it's necessary to be able delete results by script create_domains.pl if domains are redefined

FOUNDDIRS=`find /data/CASPCOMMONS/RESULTS/ -name 'T*-D*' -type d `

echo $FOUNDDIRS | xargs --no-run-if-empty chgrp casp
echo $FOUNDDIRS | xargs --no-run-if-empty chmod 775

FOUNDFILES=`find /data/CASPCOMMONS/RESULTS/ -name 'T*-D*' -type f `

echo $FOUNDFILES | xargs --no-run-if-empty chgrp casp
echo $FOUNDFILES | xargs --no-run-if-empty chmod 664

exit
