Marian writes ..

>I am writing script, that can connect to the FTP server and list
>complete directory structure. But there is problem I suppose. Assume
>next structure:
>
>AAA
> |_ AAA.1
> |_ AAA.2
> |_ AAA.3
>     |_ AAA.3.1
>         |_ aaa.txt
>         ...
>
>But when I list it with dir(), in next case, the array will be empty:
>
> @dirlist = $scan->dir("AAA/AAA.3/AAA.3.1")
>
>Is there any problem with subdirectories listing ?

there's no problem with subdirectory listings in Net::FTP v2.56 (which is
what I have on my machine - it shipped with Perl v5.6.0)

could it be possible that you've changed directory out of the top level
directory before calling the 'dir' method ?

try this

  @dirlist = $scan->dir("/AAA/AAA.3/AAA.3.1");

note the leading slash in front of the first AAA .. this will retrieve the
directory listing of that directory in an absolute fashion - meaning that it
doesn't matter which directory you're currently in

without the leading slash the directory that you've named is a relative
directory - meaning that Net::FTP will look for it beneath whatever
directory you happen to be in

alternatively - have a look at your program for a cwd() call .. if it's
there - and if you don't need it .. then take it out

if none of this works .. cut down your program into a few lines of working
code so we can see what you're doing .. like this sort of thing

  use Net::FTP;

  my $scan = Net::FTP->new( 'localhost', Debug => 0);
  $scan->login( 'anonymous', '');

  my @dirlist = $scan->dir( 'AAA/AAA.3/AAA.3.1');

  $scan->quit;

  print "$_\n" for @dirlist;


-- 
  jason king

  In Norway, you may not spay your female dog or cat.  However, you may
  neuter the males of the species. - http://dumblaws.com/

Reply via email to