Recursive FTP

I am trying to write a recursive FTP script and have come to a point where I need to test if the file is either a normal ascii file or a directory. My question is how do I test if the file is either ascii or directory.

use test

example:
Perform a mkdir if a directory does not exist:
test ! -d tempdir && mkdir tempdir

for i in *
do
if test -d "$i"
Directory processing commands......
fi
done

it is commonly used with if while do etc. in shell scripts.

-r filename True if filename exists and is readable
-w filename True if filename exists and is writable
-x filename True if filename exists and is executable
-f filename True if filename exists and is a regular file
-d filename True if filename exists and is a directory
-h filename True if filename exists and is a symbolic link.
...........

test commands returns a status of 0(true) or 1 (false) depending on the evaluation of the conditional expression, which can be unary or binary. there is a long list of expression available; check the man page for more info