File: t.pl

package info (click to toggle)
ftpwatch 1.23+nmu1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 80 kB
  • ctags: 4
  • sloc: perl: 188; makefile: 48; sh: 7
file content (18 lines) | stat: -rwxr-xr-x 468 bytes parent folder | download | duplicates (6)
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;