1. 第一种方法,使用ls
#!/bin/bash
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file $2
else
empty=`echo $dir_or_file|grep '.php$'`
if [ x$empty != 'x[......]