Deleted Added
full compact
mklink.pl (68651) mklink.pl (76866)
1#!/usr/local/bin/perl
2
3# mklink.pl
4
5# The first command line argument is a non-empty relative path
6# specifying the "from" directory.
7# Each other argument is a file name not containing / and
8# names a file in the current directory.

--- 34 unchanged lines hidden (view full) ---

43 @to_path = ("..", @to_path);
44 push(@pwd_path, $dirname);
45 }
46}
47
48my $to = join('/', @to_path);
49
50my $file;
1#!/usr/local/bin/perl
2
3# mklink.pl
4
5# The first command line argument is a non-empty relative path
6# specifying the "from" directory.
7# Each other argument is a file name not containing / and
8# names a file in the current directory.

--- 34 unchanged lines hidden (view full) ---

43 @to_path = ("..", @to_path);
44 push(@pwd_path, $dirname);
45 }
46}
47
48my $to = join('/', @to_path);
49
50my $file;
51$symlink_exists=eval {symlink("",""); 1};
51foreach $file (@files) {
52 my $err = "";
52foreach $file (@files) {
53 my $err = "";
53 symlink("$to/$file", "$from/$file") or $err = " [$!]";
54 if ($symlink_exists) {
55 symlink("$to/$file", "$from/$file") or $err = " [$!]";
56 } else {
57 system ("cp", "$file", "$from/$file") and $err = " [$!]";
58 }
54 print $file . " => $from/$file$err\n";
55}
59 print $file . " => $from/$file$err\n";
60}