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]"
}
}
|