Re: Net::FTP Problem
by grinder (Bishop) on May 31, 2001 at 14:10 UTC
|
It's been done already. Check out fsync, the
file synchroni[sz]ation utility.
-- g r i n d e r
| [reply] |
Re: Net::FTP Problem
by mullr (Sexton) on May 31, 2001 at 09:35 UTC
|
This sounds to me like a classic recursion problem. The
trick is to have one function you call on a directory which
goes throught the listing, calling itself for each
directory found. This should should allow you to traverse
an entire directory tree without any trouble.
Hope this helps.
See you, space cowboy | [reply] |
|
| [reply] |
Re: Net::FTP Problem
by the_slycer (Chaplain) on May 31, 2001 at 09:31 UTC
|
What you will need is a good recursive File Finder.
You might want to poke at the source of File::Find.
Failing that, if you run a Super Search using find file you will get a whole whack of hits, some with bad recursive search methods. Some with better. Including some here. ;-)
I think we all agree that File::Find is the best. | [reply] |
|
I'm not sure if it shows but he's using Net::FTP, which AFAIK isn't implemented in File::Find. This can turn out to be quite tricky, since FTP's filesystem isn't as accessible as a local one.
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
| [reply] |
|
No, I knew that he was using Net::FTP - notice that I said to poke at the source of File::Find. Basically just needs a recursive routine, I was just pointing him to one that is used by most people that know better.
| [reply] |
Re: Net::FTP Problem
by thpfft (Chaplain) on May 31, 2001 at 18:22 UTC
|
I suggest you have a poke around the insides of mirror. It should be a relatively simple job to adapt part of it to list rather than retrieve files.
I've just had a quick look, and i think lsparse.pl will answer a lot of questions. i was startled to find that it isn't even using strict, but it's very readable. | [reply] |
Re: Net::FTP Problem
by Malach (Scribe) on Jun 01, 2001 at 06:34 UTC
|
#!/usr/bin/perl
use Net::FTP;
$ftp = Net::FTP->new("host.name");
$ftp->login("user","password");
@data=$ftp->ls("-Rla");
$ftp->quit;
foreach $line (@data)
{
print $line."\n";
}
From there, it's just text parsing......
Malach
So, this baby seal walks into a club..... | [reply] [d/l] |
|
Are these switches ("-Rla") implemented the same in all FTP servers? There's like a billion servers out there, and not all of them are totally standards compliant.
If most of them do use these switches correctly, this is an excellent way to recurse (IMHO). If not, you may need to look a little harder.
| [reply] |
Re: Net::FTP Problem
by perldoc (Scribe) on Jun 02, 2001 at 04:45 UTC
|
| [reply] |
Re: Net::FTP Problem
by scottstef (Curate) on Jun 01, 2001 at 21:12 UTC
|
| [reply] |