#!/bin/bash
#
# Recursive read test
# (c) 2001 by Obidos
# mailto: Obidos@mail.ru
#
# License: GPL.
f()
{
	for i in `ls -l | awk '{print $9}'`	
	do
		if [ -d $i ]; then
			echo "Changing directory to $i..."
			if [ -x $i ]; then
				cd $i
				f
				cd ..
			else 
				echo "Cannot change directory. Possible wrong permissions."
			fi
		else
			echo "Reading $i, `ls -l $i | awk '{print $5}'` bytes"
			cp $i /dev/null
		fi
	done
	return
}
echo "Recursive read test"
echo "Written 2001 Obidos@mail.ru"
echo "License: GPL."
if [ -z "$1" ]; then
	w=`pwd`
else
	w=$1
fi
s=`pwd`
cd $w
f 
cd $s
