changeset 3:31c2544cc45e

Uploaded
author pitagora
date Tue, 12 Aug 2014 07:38:50 -0400
parents 061f8331778a
children e6b30960837f
files link_path_2.pl
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/link_path_2.pl	Tue Aug 12 07:38:50 2014 -0400
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+# THIS TOOL HAS BEEN DEPRECATED IN FAVOR OF THE galaxy_import.pl AND gcpd.pl METHOD
+# WHICH DON'T REQUIRE SETTING METADATA MANUALLY FOR EACH FILE.
+
+use strict;
+use File::Copy;
+
+# CONFIG
+my @allowed_paths = ('/');
+
+# ARGS
+my ($src, $dest)=@ARGV;
+die("Absolute path required\n") unless $src =~ /^\//;
+die("Paths containing '..' are disallowed\n") if $src =~ /\/\.\.\//;
+my $ok=0;
+foreach my $dir (@allowed_paths) {
+    my $re="^$dir";
+    $re =~ s/\//\\\//g;
+    if ($src =~ /$re/) {
+        $ok=1;
+        last;
+    }
+}
+die("Not an allowed source path\n") unless $ok;
+
+# CP
+# if ($src =~ /\.gz$/)
+unlink($dest);
+system("cp $src $dest");
+exit;