using finddepth in ftp to search for directories in perl

Hi all,

I have script which downloads the build and copies onto the local machine

I am able to download files in a directory, but unable to get the files in subdierctories.

I am using finddepth to search for sub directories but I am unable to do so.

Here is my code:

$ftp->Net::FTP->new();
***login code
$ftp->cwd($path);

finddepth(\&dirsub, $path) || die "cannot find dir";

sub dirsub {
next unless -d;
print "$_\n";
}
$ftp->quit;

When I run the script I get the error at the finddepth line as:

No such file or directory. How can I search for sub folders

Please help me with the code

Thanks in advance