#!/usr/bin/perl

open(FH, '<', "./aquinas_urls.txt") or die $!;

my $tick = 0;

# `cwd ./source/`;

while (<FH>) {
	$url = $_;
	$url =~ s/^.*http/http/;
	# `wget $url`;
	
	
	$url =~ m/.*\/(.*)$/;
	chomp $url;
	$file = $1;
	$file =~ s/\~//;
	
	if (-e "/home/apps1/htdocs/mathias/James/AquinasIndex/source/$file") { print qq!.!; next; }
	else {
		print "curl $url > ./source/$file";
		`curl $url > ./source/$file`;
	#	sleep(0.5);
		# exit if ++$tick > 3;
		print "Line $tick\n";
		$tick ++;
		}
	}