working with grip
how would i modify this function to descend all subdirectories of the named directory recursively and to find the maximum length of any filename in that hierarchy.
$ function maxfn () { > typeset -i max thisone > if [ ! -d "$1" -o $# = 0 ] > then > echo "Usage: maxfn dirname" > return 1 > fi > > max=0 > for fn in $(/bin/ls $1) > do > thisone=${#fn} > if [ $thisone -gt $max ] > then > max=$thisone > fi > done > echo "Longest filename is $max characters." > } |
Sometime ago I wrote a simple script to run over a directory tree recursively.
Here it is. I think you can adapt it to your problem easily. Code:
#!/bin/bash |
All times are GMT -5. The time now is 05:06 AM. |