can anyone modify my code to make it recursive search of subdiretories, currently this code only can search of particular directory.
#!/bin/bash
if test $# -eq 0 ; then
echo usage: "${0##/*} [Dir name]"
exit
fi
for arg in $* ; do
if test -e $arg ; then
maxLen=0 # <= !
files=$(ls $arg) # <=
for file in $files ; do
newLen=${#file}
if [ $newLen -gt $maxLen ] ; then
maxLen=$newLen
fileName=$file
fi
done
echo "[ Direcroty ] : $arg"
echo "[ File name ] : $fileName"
echo "[ Max length ] : $maxLen"
else
echo Cannot find $arg
fi
done
#End
botherguy