File: dlfetched.pl

package info (click to toggle)
rccp 0.9-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 244 kB
  • ctags: 44
  • sloc: ansic: 830; sh: 256; perl: 134; makefile: 71
file content (47 lines) | stat: -rwxr-xr-x 913 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl
 
##########################################################
#downloading robot for CCCP fetch script
#
#Note. This script doesn't work alone.
#
#
#
#########################################################

# ====== Configuration =======
# Done dir
$ddir="/change/this/to/your/done/directory";
#$ddir="/usr/ftp/incoming/done";

# ========== End ============




$home = $ENV{HOME};

opendir(DONEDIR, $ddir) or die "unable to open $ddir directory, check config.";
@dlfiles = readdir DONEDIR;


while(<STDIN>){
	s/\n//;
	@filename  = split /\|/;	
	$x = @filename[1];
	@y = split /\\/,$x;
	@z = split /\./,$x;
	$remotefilename = $y[scalar(@y) - 1];
	$match = 0;
	foreach $dl (@dlfiles){
		if($remotefilename eq $dl){
			$match = 1;
		}
	}
	if(!$match){
		$nick = @filename[0];
		$remotepath = $filename[1];
		$id = $z[scalar(@z) - 1];
		system "cccp -ga $id $nick \"$remotepath\" $filename[2]"
	}
}