The
find will search in the given locations. The given locations are in your case:
Code:
"$USERDIR"/*/ftp/*.jpg
But there is no expression given which will constrain the output. You could also use:
Code:
ls "$USERDIR"/*/ftp/*.jpg
in place of the
find. To use
find in a way where it actually searches the directory could be:
Code:
$ find "$USERDIR" -name "*.jpg"
or to limit it to the directories having
ftp therein:
Code:
$ find "$USERDIR" -path "*/ftp/*.jpg"
It could be speed up by writing the temporary file first, and then count the lines therein.
I don't know the complete script, but the expression you used originally can also be used in the
for loop, maybe it's possible to do it even without the list of file:
Code:
i=0
for NAME in "$USERDIR"/*/ftp/*.jpg; do
IMAGEPATH[$i]="$NAME"
IMAGENAME[$i]=`basename "$NAME"`
USERIMAGE[$i]=`expr "$NAME" : ".*/\([^/]*\)/.*/.*"` # Get the third to last part of the path
...
let i++
done