Link two files : symlink « File « Perl






Link two files

    

#!/usr/bin/perl -w

use strict;

my $filetolink = 'a.pl';
my $linkname   = 'linktoa.pl';

symlink($filetolink, $linkname) or die "link creation failed: $!";

print "link created ok!\n";

my $readlinkresult = readlink($linkname);
print "$linkname is a sym link to $readlinkresult\n";

   
    
    
    
  








Related examples in the same category

1.The symlink and readlink Functions (UNIX)