File: t.pl

package info (click to toggle)
ftpwatch 1.17
  • links: PTS
  • area: main
  • in suites: woody
  • size: 92 kB
  • ctags: 5
  • sloc: perl: 212; makefile: 46; sh: 19
file content (18 lines) | stat: -rwxr-xr-x 468 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl

use Net::FTP;

my $ftp = Net::FTP->new("ftp.bz2.us.kernel.org", Debug => 0);
if (!$ftp) {print stderr "Connect failed: '$@'\n"; next}
if (!$ftp->login) {print stderr "Login failed: '$@'\n"; next}
if (!$ftp->cwd("/pub/linux/kernel/v2.4"))  {
	if ($dir =~ /^(.*)\/([^\/]+)$/) {
		$dir=$1; $file=$2;
		if (!$ftp->cwd($dir))  {
			print stderr "No such dir: '$dir'\n"; next
		}
	} else {
		print stderr "No such dir: '$dir'\n"; next
	}
}
print $ftp->dir;