-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeturl
More file actions
executable file
·34 lines (27 loc) · 977 Bytes
/
geturl
File metadata and controls
executable file
·34 lines (27 loc) · 977 Bytes
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
#!/usr/bin/perl
# geturl url
# Yet another quick hack, this time to fetch all of the data at
# a URL.
# +------+-----------------------------------------------------------
# | Main |
# +------+
# Grab the parameter
my $url = $ARGV[0];
# Grab time info in a way useful for output
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
if ($mon < 10) { $mon = "0$mon"; }
if ($mday < 10) { $mday = "0$mday"; }
if ($hour < 10) { $hour = "0$hour"; }
if ($min < 10) { $min = "0$min"; }
if ($sec < 10) { $sec = "0$sec"; }
# Generate a directory name
my $prefix = $url;
$prefix =~ s/http:\/\///;
$prefix =~ s/https:\/\///;
$prefix =~ s/[^A-Za-z0-9-_.]/_/g;
my $dir = "$prefix-$year$mon$mday$hour$min$sec";
print STDERR "DIR is $dir\n";
my $command = "cd pages; mkdir $dir; cd $dir; wget --no-clobber --page-requisites --adjust-extension --convert-links --restrict-file-names=unix '$url'";
print STDERR "Command is $command\n";